Deployment Workflow
A simple, robust process for continuous development while maintaining a stable QA environment.
Overview
Terra uses a two-branch deployment strategy that separates active development from stable releases:| Branch | Purpose | Vercel Deployment | Who Uses It |
|---|---|---|---|
main | Active development | Preview (staging) | Engineers |
stable | Tested, approved code | Production | QA team, stakeholders |
Quick Access URLs
| Environment | URL | Branch |
|---|---|---|
| Production | terra.withunify.org | stable |
| Staging | staging-terra.withunify.org | main |
Why This Approach
Why not feature flags?
Why not feature flags?
Feature flags add complexity:
- Code pollution with
if (flag)conditionals - Flag management overhead (LaunchDarkly, etc.)
- Technical debt from forgotten flags
- Testing combinatorial explosion
main, only release when ready.Why not deploy main directly to production?
Why not deploy main directly to production?
QA needs a stable target:
- Testing a moving target is frustrating
- Hard to know if a bug is old or newly introduced
- Stakeholders need predictable demo environments
stable branch gives QA a consistent URL that only changes on intentional releases.Why not GitFlow or more branches?
Why not GitFlow or more branches?
Simpler is better for small teams:
- Two branches to understand, not five
- No release branch management
- Fast-forward merges keep history clean
- Works perfectly with Vercel’s deployment model
One-Time Setup
Step 1: Create the Stable Branch
Step 2: Configure Vercel
Open Project Settings
Go to Vercel Dashboard → Your Project → Settings → Environments
Change Branch Tracking
In the Branch Tracking section, change the branch from
main to stable and click SaveStep 3: Set Up Branch Protection (Recommended)
In GitHub → Settings → Branches → Add rule: Forstable branch:
main branch (optional, less strict):
Daily Development Workflow
For Engineers
Verify on Staging
- Vercel auto-deploys to your preview URL
- Test your changes at the staging URL
- Check the Vercel deployment logs if something fails
Quick Reference Commands
Release Process
When you’re ready for QA to test your changes:Standard Release
Check What Will Be Released
Before releasing, see what commits are queued:Notify the Team
After releasing, notify QA:Hotfix Process
For urgent bugs found in production:Vercel Deployment Details
Understanding Deployment URLs
| Branch | URL Pattern | Example |
|---|---|---|
stable | Production domain | terra.withunify.org |
main | Preview URL | terra-git-main-unify.vercel.app |
| Feature branches | Preview URL | terra-git-feat-export-unify.vercel.app |
Deployment Status
Check deployment status:Environment Variables
Bothmain and stable use the same environment variables by default. If you need different values:
- Go to Vercel → Project → Settings → Environment Variables
- Set the variable with scope:
- Production: Only
stable - Preview: Only
mainand feature branches - Development: Local only
- Production: Only
Rollback
If a bad release reaches production:Working with AI Code Review (Greptile)
If you have Greptile configured:- On PR creation: Greptile automatically analyzes changes
- Review comments: Address any flagged issues
- Re-review: Push fixes, Greptile re-analyzes
- Merge: When Greptile approves + CI passes
Working with Merge Queue (Graphite)
If you have Graphite configured:- Approve PR: After review, approve the PR
- Add to queue: Graphite queues the merge
- Sequential CI: Graphite runs CI on rebased code
- Auto-merge: If CI passes, PR merges automatically
Handling Diverged Branches
Ifgit merge main --ff-only fails:
Troubleshooting
Vercel deploy failed
Vercel deploy failed
- Check Vercel dashboard for build logs
- Common issues:
- Type errors: Run
pnpm --filter terra tsclocally - Missing env vars: Check Vercel environment settings
- Build timeout: Optimize build or increase timeout
- Type errors: Run
CI passing locally but failing on GitHub
CI passing locally but failing on GitHub
- Ensure you pushed all changes
- Check Node version matches CI (20.x)
- Run exact CI commands locally:
Merge conflicts on stable
Merge conflicts on stable
This shouldn’t happen with fast-forward merges. If it does:
- Check for hotfixes that weren’t backported
- Merge
stableintomainfirst - Then fast-forward
stabletomain
Wrong code on production
Wrong code on production
- Verify
stablebranch has expected commits:git log stable --oneline -10 - Check Vercel is deploying from
stable - Force redeploy: Vercel dashboard → Deployments → Redeploy
Summary
| Task | Command |
|---|---|
| Start work | git checkout main && git pull |
| Push to staging | git push origin main |
| See pending release | git log stable..main --oneline |
| Release to production | git checkout stable && git merge main --ff-only && git push |
| Hotfix production | Branch from stable, PR to stable, backport to main |