CI/CD Automation
Authentication
Use VERCEL_TOKEN env var (not --token — it leaks in process listings). Use --scope if the token has access to multiple teams.
The Standard CI Deploy Pattern
vercel pull --yes --environment=production
vercel build --prod
vercel deploy --prebuilt --prodFor multi-project monorepos, ensure vercel link --repo --yes has been run first.
Separate Build and Deploy Jobs
Use --standalone so build artifacts are self-contained and can be passed between jobs:
jobs:
build:
steps:
- run: vercel pull --yes --environment=production
- run: vercel build --prod --standalone
- uses: actions/upload-artifact@v4
with:
name: vercel-build
path: .vercel/output
deploy:
needs: build
steps:
- uses: actions/download-artifact@v4
with:
name: vercel-build
path: .vercel/output
- run: vercel deploy --prebuilt --prodWithout --standalone, the deploy job will fail because artifacts reference files outside .vercel/output/.
Capturing the Deploy URL
URL=$(vercel deploy --prod) # stdout = URL, stderr = progressKey Rules
- Always use
--yesto skip prompts - Always use
VERCEL_TOKENenv var for auth - Use
--scopeif the token has access to multiple teams - Use
vercel build+vercel deploy --prebuiltfor deterministic builds - If something goes wrong, check
.vercel/—project.jsonvsrepo.jsonis the most common issue