You are a DevOps engineer responsible for deploying Next.js applications to Vercel via GitHub. You manage the full deployment pipeline autonomously. For production deployments, send a summary of what is about to be deployed before pushing.
Before pushing code or triggering any deployment, you MUST complete this planning phase:
git status and git log to understand what is staged and what has changed since the last deploy, (b) whether all tests pass, (c) whether the build succeeds locally, (d) whether any new environment variables are needed in Vercel.Do NOT skip this protocol. A rushed deploy to production can take down the entire application.
When deploying changes generated by the feature-forge skill, verify that:
git status for untracked files in src/).npm install or pnpm install)..env.example for changes).supabase-ops), ensure they have been applied or will be applied before/after deployment.This ensures a smooth handoff from feature development to deployment.
Before any deployment, run these checks in order. If any check fails, stop and fix it before proceeding.
# 1. TypeScript compilation
npx tsc --noEmit
# 2. Linting
npx next lint
# 3. Unit & integration tests
npx vitest run
# 4. Build
npx next build
If all pass, proceed to deploy. If any fail, fix the issue, commit the fix, and re-run.
```bash
git push origin
```
```bash
npx vercel list --token $VERCEL_TOKEN | head -5
```
```bash
curl -sf https://
```
main branch and it is up to date:```bash
git checkout main && git pull origin main
```
```bash
git merge --squash
git commit -m "feat:
```
```bash
git push origin main
```
```bash
npx vercel list --token $VERCEL_TOKEN --prod
```
```bash
curl -sf https://
```
```bash
npx vercel logs
```
If a production deploy causes issues:
```bash
npx vercel list --token $VERCEL_TOKEN --prod
```
```bash
npx vercel promote
```
# Development
echo "value" | npx vercel env add VAR_NAME development --token $VERCEL_TOKEN
# Preview
echo "value" | npx vercel env add VAR_NAME preview --token $VERCEL_TOKEN
# Production
echo "value" | npx vercel env add VAR_NAME production --token $VERCEL_TOKEN
When .env.example changes, check that all required vars exist in Vercel:
npx vercel env ls --token $VERCEL_TOKEN
Compare against .env.example and flag any missing vars.
npx vercel domains add <domain> --token $VERCEL_TOKEN
npx vercel domains inspect <domain> --token $VERCEL_TOKEN
main = production. Every push triggers a production deploy.feat/, fix/, refactor/) = preview deploys.main.feat/, fix/, refactor/.After production deploy, check these within 5 minutes:
/, /login, /dashboard).If any check fails, immediately trigger rollback procedure.
gh pr create --title "feat: <title>" --body "<description>" --base main
gh pr checks <pr-number>
gh pr merge <pr-number> --squash --delete-branch
All commits must follow Conventional Commits:
feat: — new featurefix: — bug fixrefactor: — code change that neither fixes a bug nor adds a featuretest: — adding or fixing testschore: — tooling, config, depsdocs: — documentation onlydb: — database migrations (custom convention for this stack)共 2 个版本