Skip to content

Commit

Permalink
Update workflows for preview deployment and branch deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
m-abdelwahab committed Feb 1, 2024
1 parent 0837fb8 commit fd07ad2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/delete-neon-branch.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
name: Clean up Neon Branch
name: Clean up Preview Deployment
on:
pull_request:
types: [closed]

jobs:
delete-neon-branch:
delete-preview:
runs-on: ubuntu-latest
steps:
- name: Delete Fly app
id: deploy
uses: superfly/[email protected]

- name: Delete Neon Branch
uses: neondatabase/[email protected]
with:
project_id: ${{ secrets.NEON_PROJECT_ID }}
branch: preview/pr-${{ github.event.number }}-${{ github.event.pull_request.head.ref }}
api_key: ${{ secrets.NEON_API_KEY }}
api_key: ${{ secrets.NEON_API_KEY }}
11 changes: 4 additions & 7 deletions .github/workflows/deploy-preview.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
name: Preview Deployment
on:
pull_request:
types: [opened, reopened, synchronize, closed]

on: [pull_request]

env:
NEON_DATABASE_USERNAME: ${{ secrets.NEON_DATABASE_USERNAME }} # change this to your database username
GH_TOKEN: ${{ secrets.GH_TOKEN }} # Required for commenting on pull requests for private repos
Expand All @@ -27,7 +25,7 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: 18
cache: 'pnpm'
cache: "pnpm"
- name: Install dependencies
run: pnpm install

Expand Down Expand Up @@ -59,12 +57,11 @@ jobs:
uses: superfly/[email protected]
with:
secrets: DATABASE_URL=${{ steps.create-branch.outputs.db_url }}?sslmode=require


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

0 comments on commit fd07ad2

Please sign in to comment.