Skip to content

Use spaced token flag for Vercel CLI #15

Use spaced token flag for Vercel CLI

Use spaced token flag for Vercel CLI #15

name: vercel-production
on:
push:
branches:
- main
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check Vercel configuration
id: vercel-config
env:
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
run: |
if [ -n "${VERCEL_TOKEN}" ] && [ -n "${VERCEL_ORG_ID}" ] && [ -n "${VERCEL_PROJECT_ID}" ]; then
echo "configured=true" >> "$GITHUB_OUTPUT"
else
echo "configured=false" >> "$GITHUB_OUTPUT"
fi
- uses: actions/setup-node@v4
if: steps.vercel-config.outputs.configured == 'true'
with:
node-version: "22"
cache: "npm"
cache-dependency-path: docs/web/package-lock.json
- name: Install Vercel CLI
if: steps.vercel-config.outputs.configured == 'true'
run: npm install --global vercel@latest
- name: Pull Vercel Environment
if: steps.vercel-config.outputs.configured == 'true'
working-directory: docs/web
run: vercel pull --yes --environment=production --token "$VERCEL_TOKEN"
env:
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
- name: Build
if: steps.vercel-config.outputs.configured == 'true'
working-directory: docs/web
run: vercel build --prod --token "$VERCEL_TOKEN"
env:
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
- name: Deploy
if: steps.vercel-config.outputs.configured == 'true'
working-directory: docs/web
run: vercel deploy --prebuilt --prod --token "$VERCEL_TOKEN"
env:
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
- name: Skip deploy when Vercel secrets are missing
if: steps.vercel-config.outputs.configured != 'true'
run: |
echo "Skipping Vercel production deploy because VERCEL_TOKEN, VERCEL_ORG_ID, or VERCEL_PROJECT_ID is not configured."
echo "Configure those repository secrets to enable automatic production deployment."