Skip to content

Instantly share code, notes, and snippets.

@clarkbw
Last active May 15, 2024 06:19
Show Gist options
  • Save clarkbw/1ccae701bf3d2e34dbd829d34a70767e to your computer and use it in GitHub Desktop.
Save clarkbw/1ccae701bf3d2e34dbd829d34a70767e to your computer and use it in GitHub Desktop.
Ideal GitHub Action for Fly preview w/ Neon database
name: PR Review
on:
# Run this workflow on every PR event. Existing review apps will be updated when the PR is updated.
# Neon branches are created and removed according to PR updates
pull_request:
types: [opened, reopened, synchronize, closed]
jobs:
pr-preview:
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 }}
environment:
name: review
url: ${{ steps.deploy.outputs.url }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- run: npm install
# exports DATABASE_URL to use in next steps
- uses: neondatabase/pr-review-branch@v1
- run: npm run db:migrate
- id: deploy
uses: superfly/fly-pr-review-apps@1.2.0
with:
secrets: DATABASE_URL=${{ env.DATABASE_URL }}
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
@duskpoet
Copy link

Ok, nice, got it, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment