Vercel Deploy Hooks — Quick Setup
Where: Project Settings → Git → Deploy Hooks
Create a hook:
- Name it (e.g.,
main-deploy,staging-deploy) - Select the branch (
mainorstaging) - Hit Create → Copy the URL
You’ll get a unique URL like:
https://api.vercel.com/v1/integrations/deploy/prj_xxxx/yyyyTrigger a deploy:
curl -X POST https://api.vercel.com/v1/integrations/deploy/prj_xxxx/yyyyCreate Staging Environment on Vercel
Where: Project Settings → Environments
1. Create the staging environment:
- Click “Create Environment”
- Name it
staging(orStaging) - Set Branch Tracking →
staging- you will have to create staging branch on GitHub first - Optionally attach domain
- Import Variables from production environment
2. Disable Deployment Protection:
Navigate to project settings -> Deployment Protection:
- Deployment Protection → Vercel Authentication → OFF
Now anyone with the URL can view staging without logging in.
3. Add a custom domain (optional):
Project Settings → Domains → Add staging.yourdomain.com
Edit → assign it to the staging environment/branch.
GitHub Actions Setup
1. Store the hook URL as a secret:
Repo → Settings → Secrets and variables → Actions → New repository secret
- Name:
VERCEL_DEPLOY_HOOK_MAIN(and/orVERCEL_DEPLOY_HOOK_STAGING) - Value: your deploy hook URL
2. Create workflow file .github/workflows/deploy.yml:
name: Trigger Vercel Deploy
on:
push:
branches: [main, staging]
# or trigger manually:
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Deploy Main
if: github.ref == 'refs/heads/main'
run: curl -X POST ${{ secrets.VERCEL_DEPLOY_HOOK_MAIN }}
- name: Deploy Staging
if: github.ref == 'refs/heads/staging'
run: curl -X POST ${{ secrets.VERCEL_DEPLOY_HOOK_STAGING }}Last updated on