Openstatus
www.openstatus.dev
1name: Fly Preview Workflows
2on:
3 pull_request:
4 types: [opened, reopened, synchronize, closed]
5 paths:
6 - "apps/workflows/**"
7 - "packages/db/**"
8 - "packages/emails/**"
9 - "packages/utils/**"
10 - "packages/notifications/**"
11 - "packages/tsconfig/**"
12
13env:
14 FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
15 # Set these to your Fly.io organization and preferred region.
16 FLY_REGION: ams
17 FLY_ORG: openstatus
18
19jobs:
20 review_app:
21 runs-on: ubuntu-latest
22 outputs:
23 url: ${{ steps.deploy.outputs.url }}
24 # Only run one deployment at a time per PR.
25 concurrency:
26 group: pr-${{ github.event.number }}
27
28 # Deploying apps with this "review" environment allows the URL for the app to be displayed in the PR UI.
29 # Feel free to change the name of this environment.
30 environment:
31 name: pr-${{ github.event.number }} # The script in the `deploy` sets the URL output for each review app.
32 url: ${{ steps.deploy.outputs.url }}
33 steps:
34 - name: Get code
35 uses: actions/checkout@v4
36
37 - name: Deploy PR app to Fly.io
38 id: deploy
39 uses: superfly/fly-pr-review-apps@1.2.1
40 with:
41 config: apps/workflows/fly.toml
42 vmsize: shared-cpu-1x
43 name: openstatus-workflows-pr-${{ github.event.number }}
44 secrets: |
45 DATABASE_URL=${{ secrets.STAGING_DB_URL }}
46 DATABASE_AUTH_TOKEN=${{ env.STAGING_DB_AUTH_TOKEN }}
47 RESEND_API_KEY=${{ secrets.STAGING_RESEND_API_KEY }}
48 UPSTASH_REDIS_REST_URL=test
49 UPSTASH_REDIS_REST_TOKEN=test
50 GCP_PROJECT_ID=test
51
52 - name: Clean up GitHub environment
53 uses: strumwolf/delete-deployment-environment@v2
54 if: ${{ github.event.action == 'closed' }}
55 with:
56 # ⚠️ The provided token needs permission for admin write:org
57 token: ${{ secrets.GITHUB_TOKEN }}
58 environment: pr-${{ github.event.number }}