Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/workflows/deploy_preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Vercel Preview Deployment

env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}

on:
pull_request:
branches: [ "master" ]
workflow_dispatch:

concurrency:
group: "vercel-preview-${{ github.event.pull_request.number }}"
cancel-in-progress: true

jobs:
test:
uses: ./.github/workflows/tests.yml

deploy-preview:
needs: [test]
runs-on: ubuntu-latest
# Do not run for PR from forks
if: github.event.pull_request.head.repo.full_name == github.repository

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install Vercel CLI
run: npm install --global [email protected]

- 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 }}
38 changes: 38 additions & 0 deletions .github/workflows/deploy_production.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Vercel Production Deployment

env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}

on:
push:
branches: [ "master" ]
workflow_dispatch:

concurrency:
group: "vercel-production-${{ github.ref }}"
cancel-in-progress: false # waits for the previous one to finish

jobs:
test:
uses: ./.github/workflows/tests.yml

deploy-production:
needs: [test]
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install Vercel CLI
run: npm install --global [email protected]

- name: Pull Vercel Environment Information
run: vercel pull --yes --environment=production --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 --prod --token=${{ secrets.VERCEL_TOKEN }}
5 changes: 1 addition & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
name: Tests

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
workflow_call:
workflow_dispatch:

jobs:
Expand Down
6 changes: 5 additions & 1 deletion vercel.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,9 @@
"src": "/(.*)",
"dest": "/api/vercel_function"
}
]
],

"git": {
"deploymentEnabled": false
}
}