✅ Deploying to Vercel from a Private GitHub Repo Using GitHub Actions (Without Upgrading)
Deploying to Vercel with a free plan is easy when using a personal Vercel account and the Vercel CLI. If you're working within an organization or team account on Vercel and don't want to upgrade, this guide will help you bypass that requirement using GitHub Actions and a manual deployment pipeline.
🔧 Requirements
- A personal Vercel account (not a team/org)
- A personal Vercel token
- A private GitHub repo
- Node.js project (Next.js, React, etc.)
🚀 Setting Up GitHub Actions for Vercel Deployment
Create a GitHub Actions workflow file at:
.github/workflows/deploy.yml
📝 Full deploy.yml Example
name: CI & Deploy to Vercel
on:
push:
branches:
- main
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Install dependencies
run: npm ci
- name: Run linter
run: npm run lint
- name: Run tests
run: npm test
- name: Run build
run: npm run build
- name: Install Vercel CLI
run: npm install -g vercel
- name: Deploy to Vercel
env:
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
run: vercel --prod --yes --token $VERCEL_TOKEN
🛡️ Security Notes
- Vercel token is stored securely in GitHub Secrets.
- Only pushes to
maintrigger deployment. - Forks/clones cannot access your secrets and cannot deploy.
🔑 How to Generate and Use a Vercel Token
- Go to https://vercel.com/account/tokens
- Generate a personal token
- In GitHub, go to your repo →
Settings→Secrets and variables→Actions - Add the token as a secret named
VERCEL_TOKEN
🧹 Optional Commands for Production Readiness
You can add the following steps to your workflow:
| Command | Description |
|---|---|
npm run lint | Run ESLint |
npm test | Run unit tests |
npm run build | Check build success before deploy |
npm run type-check | Run TypeScript checks |
npx tsc --noEmit | Standalone TypeScript check |
🧪 Example package.json Scripts
"scripts": {
"lint": "eslint .",
"test": "jest",
"build": "next build",
"type-check": "tsc --noEmit"
}
❌ Avoiding the .vercel/project.json Issue
If your project contains:
{
"projectId": "prj_abc123",
"orgId": "team_xyz456"
}
Delete it to unlink the project from a team and allow CLI to create a new personal project on first deploy.
🧠 Tips & Best Practices
- Use branches: Create dev/staging branches and deploy separately.
- Protect main: Use branch protection rules in GitHub.
- Review logs: Use both GitHub Actions and Vercel logs to debug.
- Environment variables: Set via Vercel dashboard or CLI.
✅ Summary
| What You Did | Why It's Useful |
|---|---|
| Created GitHub Action with Vercel CLI | Avoided Pro plan requirement |
| Used personal Vercel token | Bypassed org/team restriction |
| Added lint/test/build steps | Improved production safety |
Scoped deploy to main branch | Prevented unintentional deploys |
