Skip to content

Deploy — Vercel

Deploys a preview or production build to Vercel using the Vercel CLI. On pull requests, automatically posts or updates a comment with the preview URL.

Usage

yaml
jobs:
  deploy:
    uses: KevinDeBenedetti/github-workflows/.github/workflows/deploy-vercel.yml@main
    with:
      environment: preview
    secrets:
      VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
      VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
      VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}

Inputs

InputTypeDefaultDescription
environmentstringpreviewTarget environment: preview | production
working-directorystring'.'Path to the app root (e.g. apps/web)
node-versionstring'20'Node.js version

Secrets

SecretRequiredDescription
VERCEL_TOKENyesVercel personal access token
VERCEL_ORG_IDyesVercel team/org ID
VERCEL_PROJECT_IDyesVercel project ID

Outputs

OutputDescription
deployment-urlURL of the Vercel deployment

Notes

  • Uses vercel pullvercel buildvercel deploy --prebuilt to avoid a second build on Vercel's side.
  • When environment: production, the --prod flag is passed to both vercel build and vercel deploy.
  • On pull requests with environment: preview, an existing preview comment is updated rather than a new one being created.
  • Deploy concurrency is set to cancel-in-progress: false to preserve running deployments.