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