From de0a8c6128894ff32bdb65cb7a7be8d4b7ded70f Mon Sep 17 00:00:00 2001 From: Adam Daley Date: Wed, 22 Nov 2023 21:19:13 +0000 Subject: [PATCH] Move Vercel deployment to GitHub workflow --- .github/workflows/deploy-preview.yml | 31 +++++++++++++++++++++++++ .github/workflows/deploy-production.yml | 27 +++++++++++++++++++++ vercel.json | 1 + 3 files changed, 59 insertions(+) create mode 100644 .github/workflows/deploy-preview.yml create mode 100644 .github/workflows/deploy-production.yml diff --git a/.github/workflows/deploy-preview.yml b/.github/workflows/deploy-preview.yml new file mode 100644 index 0000000..2d8845f --- /dev/null +++ b/.github/workflows/deploy-preview.yml @@ -0,0 +1,31 @@ +name: Vercel Deploy Preview +env: + VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} + VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} +on: + push: + branches-ignore: + - main + pull_request: + branches: + - main + +concurrency: + group: deploy-preview-${{ github.event.pull_request.head.sha || github.ref }} + cancel-in-progress: true + +jobs: + deploy-preview: + name: Build and Deploy Preview + runs-on: ubuntu-latest + environment: Preview + steps: + - uses: actions/checkout@v4 + - name: Install Vercel CLI + run: npm install --global vercel@latest + - name: Pull Vercel Environment Information + run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }} + - name: Build Project Artifacts + run: vercel build --token=${{ secrets.VERCEL_TOKEN }} + - name: Deploy Project Artifacts to Vercel + run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/deploy-production.yml b/.github/workflows/deploy-production.yml new file mode 100644 index 0000000..e8adbe3 --- /dev/null +++ b/.github/workflows/deploy-production.yml @@ -0,0 +1,27 @@ +name: Vercel Deploy Production +env: + VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} + VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} +on: + push: + branches: + - main + +concurrency: + group: deploy-production + +jobs: + deploy-production: + name: Build and Deploy Production + runs-on: ubuntu-latest + environment: Production + steps: + - uses: actions/checkout@v4 + - name: Install Vercel CLI + run: npm install --global vercel@latest + - name: Pull Vercel Environment Information + run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }} + - name: Build Project Artifacts + run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }} + - name: Deploy Project Artifacts to Vercel + run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }} \ No newline at end of file diff --git a/vercel.json b/vercel.json index ad258d6..bf0ac2c 100644 --- a/vercel.json +++ b/vercel.json @@ -1,5 +1,6 @@ { "github": { + "enabled": false, "silent": true } } \ No newline at end of file