Skip to content

Commit

Permalink
Update deploy-preview.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
m-abdelwahab authored May 8, 2024
1 parent 0ba78e8 commit c825d3d
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions .github/workflows/deploy-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Preview Deployment
on: [pull_request]

env:
NEON_PROJECT_ID: ${{ var.NEON_PROJECT_ID }} # You can find this in your Neon project settings
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

Expand Down Expand Up @@ -31,27 +31,28 @@ jobs:
uses: tj-actions/branch-names@v8

- id: create-branch
uses: neondatabase/create-branch-action@v4
uses: neondatabase/create-branch-action@v5
with:
project_id: ${{ env.NEON_PROJECT_ID }}
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/pr-${{ github.event.number }}-${{ steps.branch-name.outputs.current_branch }}
branch_name: preview/${{ steps.branch-name.outputs.current_branch }}
api_key: ${{ secrets.NEON_API_KEY }} # Generate a an API key in your Neon account settings

- run: |
echo "DATABASE_URL=${{ steps.create-branch.outputs.db_url_with_pooler }}?sslmode=require" >> "$GITHUB_ENV"
echo "DATABASE_URL=${{ steps.create-branch.outputs.db_url_with_pooler }}" >> "$GITHUB_ENV"
- run: pnpm run db:migrate

- id: deploy
uses: superfly/[email protected].0
uses: superfly/[email protected].1
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
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 }}

0 comments on commit c825d3d

Please sign in to comment.