Skip to content

Use remote Vercel deploy in workflow #4

Use remote Vercel deploy in workflow

Use remote Vercel deploy in workflow #4

Workflow file for this run

name: Deploy Vercel
on:
workflow_dispatch:
push:
branches:
- main
paths:
- ".github/workflows/deploy-vercel.yml"
- "api/**"
- "catpred/web/**"
- "catpred/web/frontend/**"
- "catpred/**"
- "requirements.txt"
- "vercel.json"
jobs:
deploy:
runs-on: ubuntu-latest
permissions:
contents: read
concurrency:
group: vercel-production-deploy
cancel-in-progress: true
env:
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
steps:
- name: Skip when Vercel credentials are not configured
if: ${{ env.VERCEL_TOKEN == '' || env.VERCEL_ORG_ID == '' || env.VERCEL_PROJECT_ID == '' }}
run: echo "Skipping Vercel deploy because VERCEL_TOKEN / VERCEL_ORG_ID / VERCEL_PROJECT_ID are not configured."
- name: Checkout
if: ${{ env.VERCEL_TOKEN != '' && env.VERCEL_ORG_ID != '' && env.VERCEL_PROJECT_ID != '' }}
uses: actions/checkout@v4
- name: Set up Node.js
if: ${{ env.VERCEL_TOKEN != '' && env.VERCEL_ORG_ID != '' && env.VERCEL_PROJECT_ID != '' }}
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Install Vercel CLI
if: ${{ env.VERCEL_TOKEN != '' && env.VERCEL_ORG_ID != '' && env.VERCEL_PROJECT_ID != '' }}
run: npm install --global vercel@latest
- name: Pull Vercel project settings
if: ${{ env.VERCEL_TOKEN != '' && env.VERCEL_ORG_ID != '' && env.VERCEL_PROJECT_ID != '' }}
run: vercel pull --yes --environment=production --token="${VERCEL_TOKEN}"
- name: Deploy
if: ${{ env.VERCEL_TOKEN != '' && env.VERCEL_ORG_ID != '' && env.VERCEL_PROJECT_ID != '' }}
run: vercel deploy --prod --yes --token="${VERCEL_TOKEN}"