Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trying a review environment w/ deploy-preview.yml #16

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 10 additions & 15 deletions .github/workflows/deploy-preview.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
name: Preview Deployment
on: [pull_request]

env:
NEON_PROJECT_ID: ${{ vars.NEON_PROJECT_ID }} # You can find this in your Neon project settings
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} # You can generate a Fly API token in your account settings
GH_TOKEN: ${{ secrets.GH_TOKEN }} # Required for commenting on pull requests for private repos

jobs:
deploy-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: pnpm/action-setup@v2
Expand All @@ -33,7 +34,7 @@ jobs:
- id: create-branch
uses: neondatabase/create-branch-action@v5
with:
project_id: ${{ env.NEON_PROJECT_ID }}
project_id: ${{ vars.NEON_PROJECT_ID }} # You can find this in your Neon project settings
username: "neondb_owner" # Change this to the role you use to connect to your database
# parent: dev # optional (defaults to your primary branch)
branch_name: preview/${{ steps.branch-name.outputs.current_branch }}
Expand All @@ -46,13 +47,7 @@ jobs:

- id: deploy
uses: superfly/[email protected]
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} # You can generate a Fly API token in your account settings
with:
secrets: DATABASE_URL=$DATABASE_URL

- name: Comment on Pull Request
uses: thollander/actions-comment-pull-request@v2
with:
GITHUB_TOKEN: ${{ env.GH_TOKEN }} # Required for commenting on pull requests for private repos
message: |
Fly Preview URL :balloon: : ${{ steps.deploy.outputs.url }}
Neon branch :elephant: : https://console.neon.tech/app/projects/${{ env.NEON_PROJECT_ID }}/branches/${{ steps.create-branch.outputs.branch_id }}
secrets: DATABASE_URL=$DATABASE_URL
Loading