Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 58 additions & 13 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
uses: bahmutov/npm-install@v1

- name: πŸ„ Copy test env vars
run: cp .env.example .env
run: cp .env.example .env

- name: πŸ›  Setup Database
run: npx prisma migrate deploy && npx prisma generate --sql
Expand All @@ -58,7 +58,7 @@ jobs:
run: npm run build

- name: πŸ„ Copy test env vars
run: cp .env.example .env
run: cp .env.example .env

- name: πŸ›  Setup Database
run: npx prisma migrate deploy && npx prisma generate --sql
Expand All @@ -82,7 +82,7 @@ jobs:
uses: bahmutov/npm-install@v1

- name: πŸ„ Copy test env vars
run: cp .env.example .env
run: cp .env.example .env

- name: πŸ›  Setup Database
run: npx prisma migrate deploy && npx prisma generate --sql
Expand Down Expand Up @@ -143,13 +143,57 @@ jobs:
path: playwright-report/
retention-days: 30

container:
name: πŸ“¦ Prepare Container
runs-on: ubuntu-24.04
# only prepare container on pushes
if: ${{ github.event_name == 'push' }}
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 50

- name: πŸ‘€ Read app name
uses: SebRollen/[email protected]
id: app_name
with:
file: 'fly.toml'
field: 'app'

- name: 🎈 Setup Fly
uses: superfly/flyctl-actions/[email protected]

- name: πŸ“¦ Build Staging Container
if: ${{ github.ref == 'refs/heads/dev' }}
run: |
flyctl deploy \
--build-only \
--push \
--image-label ${{ github.sha }} \
--build-arg COMMIT_SHA=${{ github.sha }} \
--app ${{ steps.app_name.outputs.value }}-staging
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}

- name: πŸ“¦ Build Production Container
if: ${{ github.ref == 'refs/heads/main' }}
run: |
flyctl deploy \
--build-only \
--push \
--image-label ${{ github.sha }} \
--build-arg COMMIT_SHA=${{ github.sha }} \
--app ${{ steps.app_name.outputs.value }}
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}

deploy:
name: πŸš€ Deploy
runs-on: ubuntu-22.04
needs: [lint, typecheck, vitest, playwright]
# only build/deploy branches on pushes
runs-on: ubuntu-24.04
needs: [lint, typecheck, vitest, playwright, container]
# only deploy on pushes
if: ${{ github.event_name == 'push' }}

steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v4
Expand All @@ -168,16 +212,17 @@ jobs:

- name: πŸš€ Deploy Staging
if: ${{ github.ref == 'refs/heads/dev' }}
run:
flyctl deploy --remote-only --build-arg COMMIT_SHA=${{ github.sha }}
--app ${{ steps.app_name.outputs.value }}-staging
run: |
IMAGE="registry.fly.io/${{ steps.app_name.outputs.value }}-staging:${{ github.sha }}"
flyctl deploy --image $IMAGE --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 --remote-only --build-arg COMMIT_SHA=${{ github.sha }}
--build-secret SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }}
run: |
IMAGE="registry.fly.io/${{ steps.app_name.outputs.value }}:${{ github.sha }}"
flyctl deploy --image $IMAGE \
--build-secret SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }}
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}