name: Fly Preview API server on: pull_request: types: [opened, reopened, synchronize, closed] paths: - "apps/server/**" - "packages/db/**" - "packages/emails/**" - "packages/regions/**" - "packages/tsconfig/**" - "packages/utils/**" - "packages/upstash/**" env: FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} # Set these to your Fly.io organization and preferred region. FLY_REGION: ams FLY_ORG: openstatus jobs: review_app: runs-on: depot-ubuntu-24.04-4 timeout-minutes: 15 outputs: url: ${{ steps.deploy.outputs.url }} # Only run one deployment at a time per PR. concurrency: group: pr-${{ github.event.number }} # Deploying apps with this "review" environment allows the URL for the app to be displayed in the PR UI. # Feel free to change the name of this environment. environment: name: pr-${{ github.event.number }} # The script in the `deploy` sets the URL output for each review app. url: ${{ steps.deploy.outputs.url }} steps: - name: Get code uses: actions/checkout@v4 - name: Deploy PR app to Fly.io id: deploy uses: superfly/fly-pr-review-apps@1.2.1 with: config: apps/server/fly.toml vmsize: shared-cpu-1x name: openstatus-api-pr-${{ github.event.number }} secrets: | DATABASE_URL=${{ secrets.STAGING_DB_URL }} DATABASE_AUTH_TOKEN=${{ env.STAGING_DB_AUTH_TOKEN }} RESEND_API_KEY=${{ secrets.STAGING_RESEND_API_KEY }} UPSTASH_REDIS_REST_URL=test UPSTASH_REDIS_REST_TOKEN=test GCP_PROJECT_ID=test NEXT_PUBLIC_OPENPANEL_CLIENT_ID=test OPENPANEL_CLIENT_SECRET=test - name: Clean up GitHub environment uses: strumwolf/delete-deployment-environment@v2 if: ${{ github.event.action == 'closed' }} with: # ⚠️ The provided token needs permission for admin write:org token: ${{ secrets.GITHUB_TOKEN }} environment: pr-${{ github.event.number }}