Skip to content

Open-source status page, incident response and uptime monitoring

🔥 pr preview fly (#1467)

Thibault Le Ouay65275ea00780
diff --git a/.github/workflows/api-preview.yml b/.github/workflows/api-preview.yml
new file mode 100644
index 000000000..96fda3604
--- /dev/null
+++ b/.github/workflows/api-preview.yml
@@ -0,0 +1,59 @@
+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: ubuntu-latest
+ 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/[email protected]
+ 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
+
+ - 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 }}
diff --git a/.github/workflows/workflow-preview.yml b/.github/workflows/workflow-preview.yml
index a5d59ee49..9e1b631fb 100644
--- a/.github/workflows/workflow-preview.yml
+++ b/.github/workflows/workflow-preview.yml
@@ -7,7 +7,9 @@ on:
- "packages/db/**"
- "packages/emails/**"
- "packages/utils/**"
+ - "packages/notifications/**"
- "packages/tsconfig/**"
+
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
# Set these to your Fly.io organization and preferred region.