uhh #62
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: π Deploy | |
on: | |
push: | |
branches: | |
- main | |
- dev | |
pull_request: {} | |
permissions: | |
actions: write | |
contents: read | |
jobs: | |
lint: | |
name: ⬣ Biome Check | |
runs-on: ubuntu-latest | |
steps: | |
- name: π Cancel Previous Runs | |
uses: styfle/[email protected] | |
- name: β¬οΈ Checkout repo | |
uses: actions/checkout@v3 | |
- name: β Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 22 | |
- name: π₯ Install pnpm | |
uses: pnpm/action-setup@v4 | |
with: | |
version: 9.6.0 | |
- name: π₯ Download deps | |
run: pnpm install --frozen-lockfile | |
- name: Setup Biome | |
uses: biomejs/[email protected] | |
with: | |
biome-version: 1.8.3 | |
- name: π¬ Lint | |
run: pnpm check | |
typecheck: | |
name: Κ¦ TypeScript | |
runs-on: ubuntu-latest | |
steps: | |
- name: π Cancel Previous Runs | |
uses: styfle/[email protected] | |
- name: β¬οΈ Checkout repo | |
uses: actions/checkout@v3 | |
- name: β Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 22 | |
- name: π₯ Install pnpm | |
uses: pnpm/action-setup@v4 | |
with: | |
version: 9.6.0 | |
- name: π₯ Download deps | |
run: pnpm install --frozen-lockfile | |
- name: π Type check | |
run: pnpm run typecheck | |
deploy: | |
name: π Deploy | |
runs-on: ubuntu-22.04 | |
needs: [lint, typecheck] | |
# only build/deploy main branch on pushes | |
if: | |
${{ (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev') && | |
github.event_name == 'push' }} | |
steps: | |
- name: β¬οΈ Checkout repo | |
uses: actions/checkout@v3 | |
- name: π Read app name | |
uses: SebRollen/[email protected] | |
id: app_name | |
with: | |
file: 'fly.toml' | |
field: 'app' | |
- name: π Setup Fly | |
uses: superfly/flyctl-actions/setup-flyctl@master | |
- name: π Deploy Staging | |
if: ${{ github.ref == 'refs/heads/dev' }} | |
run: | |
flyctl deploy --build-arg COMMIT_SHA=${{ github.sha }} | |
--app ${{ steps.app_name.outputs.value }}-staging | |
env: | |
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} | |
- name: π Deploy Production | |
if: ${{ github.ref == 'refs/heads/main' }} | |
run: flyctl deploy --build-arg COMMIT_SHA=${{ github.sha }} | |
env: | |
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} |