Updating the deploy-preview.yml #15
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Preview Deployment | ||
on: [pull_request] | ||
env: | ||
NEON_PROJECT_ID: ${{ var.NEON_PROJECT_ID }} # You can find this in your Neon project settings | ||
Check failure on line 5 in .github/workflows/deploy-preview.yml GitHub Actions / Preview DeploymentInvalid workflow file
|
||
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 | ||
# Only run one deployment at a time per PR. | ||
concurrency: | ||
group: pr-${{ github.event.number }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: pnpm/action-setup@v2 | ||
with: | ||
version: 8 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18 | ||
cache: "pnpm" | ||
- run: pnpm install | ||
- name: Get cleaned up branch name | ||
id: branch-name | ||
uses: tj-actions/branch-names@v8 | ||
- id: create-branch | ||
uses: neondatabase/create-branch-action@v4 | ||
with: | ||
project_id: ${{ env.NEON_PROJECT_ID }} | ||
# parent: dev # optional (defaults to your primary branch) | ||
branch_name: preview/pr-${{ github.event.number }}-${{ steps.branch-name.outputs.current_branch }} | ||
username: ${{ secrets.NEON_DATABASE_USERNAME }} # change to your Neon database username / role | ||
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" | ||
- run: pnpm run db:migrate | ||
- id: deploy | ||
uses: superfly/[email protected] | ||
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 }} |