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