Guide to deploy from self-hosted GitLab to Vercel using GitLab CI/CD pipeline.
# Install Vercel CLInpm i -g vercel
# Login and link projectvercel logincd your-projectvercel linkGet your tokens from .vercel/project.json:
projectIdorgIdGet Vercel Token:
# Go to: https://vercel.com/account/tokens# Create new tokenIn GitLab:
Project → Settings → CI/CD → VariablesAdd these variables:
VERCEL_TOKEN (your token, masked)VERCEL_ORG_ID (your org ID)VERCEL_PROJECT_ID (your project ID).gitlab-ci.ymlimage: node:24
stages: - deploy
deploy_preview: stage: deploy only: - merge_requests script: - npm install -g vercel - vercel pull --yes --environment=preview --token=$VERCEL_TOKEN - vercel build --token=$VERCEL_TOKEN - vercel deploy --prebuilt --token=$VERCEL_TOKEN
deploy_production: stage: deploy only: - main script: - npm install -g vercel - vercel pull --yes --environment=production --token=$VERCEL_TOKEN - vercel build --prod --token=$VERCEL_TOKEN - vercel deploy --prebuilt --prod --token=$VERCEL_TOKEN