From 4803c956dc7a2a9179a4923e68544bbdbbd091e8 Mon Sep 17 00:00:00 2001 From: zomars Date: Tue, 8 Nov 2022 13:27:55 -0700 Subject: [PATCH] DB previews take 2 --- .github/workflows/db-preview.yml | 37 ++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/db-preview.yml diff --git a/.github/workflows/db-preview.yml b/.github/workflows/db-preview.yml new file mode 100644 index 0000000000..6604523f4c --- /dev/null +++ b/.github/workflows/db-preview.yml @@ -0,0 +1,37 @@ +# .github/workflows/preview.yml + +name: Preview Environment + +env: + SNAPLET_ACCESS_TOKEN: ${{ secrets.SNAPLET_ACCESS_TOKEN }} + SNAPLET_PROJECT_ID: ${{ secrets.SNAPLET_PROJECT_ID }} + VERCEL_ACCESS_TOKEN: ${{ secrets.VERCEL_ACCESS_TOKEN }} + VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} + +on: + pull_request: + types: [opened, synchronize, closed] + branches: + - main + +jobs: + db-preview-deploy: + if: ${{ github.event.action == 'opened' || github.event.action == 'synchronize' }} + runs-on: ubuntu-latest + steps: + - id: snaplet + uses: snaplet/action@v1 + - uses: snaplet/vercel-action@v1 + with: + env: | + DATABASE_URL=${{ steps.snaplet.outputs.database-url }} + db-preview-delete: + if: ${{ github.event.action == 'closed' }} + runs-on: ubuntu-latest + steps: + - uses: snaplet/action@v1 + with: + delete: true + - uses: snaplet/vercel-action@v1 + with: + delete: true