How your code reaches users
Merging your PR doesn’t put it in front of users. It waits on the next branch until a release includes it. There’s no fixed schedule: the release lead decides when each release ships. Before that, an automatic deploy puts the release on staging, a practice copy of the app, where you and your team follow each PR’s hand checks. A problem there comes back as a fix PR.
This page shows a team setup: approvals on, and the AUTO_RELEASE,
DEPLOY_STAGING and DEPLOY_PRODUCTION switches on. A new fork starts with all
four off: no approvals, no staging, and releases and deploys run by hand.
Working alone? Read What changes when a switch is off first.
Follow your PR
Each step says when to move on. Open its Commands drawer for what to run.
- Your PR on your branch
- YouYour laptopon your branch
Step 1: Work on your branch
Checks run on your laptop each time you commit and push. If one fails, that commit or push stops until you fix what it names.Lefthook · installed by bin/setupMove on whenYour change works in the app, and the push went through. Go to step 2.Commands
git fetch && git switch -c fix-login origin/nextStart your branch from the latest next.bin/devRun the app and click through your change.bin/test-plan --runThe specs your change can break: what the push checks run.bin/parallel-rspecThe whole suite, the way CI runs it.git push -u origin fix-loginLefthook's checks run first. If one fails, fix what it names and push again. - YouGitHubon your branch
Step 2: Open a PR into next
nextis the default branch, so GitHub selects it automatically. Add a one-line changelog file tochangelog.d/, and write your hand checks in the PR: steps a teammate can repeat on staging to see your change work.Move on whenThe PR has its changelog file, and numbered hand checks under “What the specs can't show”. Step 3 starts by itself.Commands
Your changelog file, such as- The help page gives the support address.changelog.d/fix-login.md: one line written for someone using the app. With no heading, it goes under “Changed”.gh pr create --base next --title "Say what changed"Opens the PR into next. Add--webto fill in the template's sections in your browser. - BotGitHubon your branch
Step 3: GitHub Actions tests your PR
Also called CI. The PR can't merge until the tests pass.ci.ymlMove on whenstaticandtestare both green. Go to step 4.Commands
gh pr checks --watchWatch the checks from your terminal.A red check is yours to fix: open it, fix the cause on your branch and push. The checks run again.gh run rerun <run-id> --failedReruns only the failed jobs, for a failure your change didn't cause, like a network timeout. - TeamGitHubmerged into next
Step 4: Approved, then merged
A teammate approves the code, unless your repo is set up for solo work. Your branch must be up to date with next, so if next has new commits, GitHub's Update branch button merges next into yours first. That's where the “Merge branch 'next' into …” commits in your history come from. With tests passing, it merges into next.Move on whenGitHub shows the PR as Merged. There's nothing for you to do until step 5 or step 9.Commands
gh pr edit --add-reviewer <teammate>Ask a teammate to review.gh pr update-branchThe Update branch button, from your terminal.gh pr merge --auto --mergeMerges by itself once it's approved and green. - Your PR is merged.It isn't live yet, and there's nothing for you to do now. It comes back to you only if it breaks the tests on next (step 5) or when its release reaches staging (step 9). The release lead ships it to users (step 10).
- The release on next, then the release branch
- BotGitHubon next
Step 5: Tests run again on next
After every merge, the whole suite runs on next. Code on next isn't deployed anywhere.⏸ The release may stop hereIf tests on next fail, the release branch (step 7) can't be made. If your PR broke the tests, you fix them with a PR into next. If you can't, the release lead takes over. When the tests pass, the release continues automatically.ChangelogOnce step 6's changelog PR has merged,CHANGELOG.mdon next has a## v2026.11.18heading. From then on, a fix's changelog line goes under that heading, not inchangelog.d/. A file inchangelog.d/would make the fix wait for the release after this one.Move on whenThe newest run on next is green. Steps 6 and 7 run automatically.Commands
gh run list --branch next --workflow ci.yml --limit 3The latest test runs on next.gh run watchFollow a run while it goes.git switch -c fix-next origin/nextIf your PR broke the tests: fix them on a branch from next, then open a PR into next as in steps 1–4. - Botrelease_flowon next
Step 6: The release is named with the date
Like2026.11.18. Everyone's changelog lines are gathered into one list. This starts when merged work is waiting and no other release is in progress.bin/release prepare⏸ Your change can wait hereWhile another release is still in progress, yours waits for the next one. Nothing for you to do.Move on whenThe changelog PR has merged into next. Go to step 7.Commands
WithAUTO_RELEASEon, this runs after every merge into next asbin/release prepare --if-needed.bin/release prepareBy hand, for the release lead. It opens a changelog PR into next that merges itself.bin/release prepare --dry-runShows what it would do, without doing it.It refuses when no changelog files are waiting, or while another release is in progress, and says which. - Botrelease_flowcopies next to release/2026.11.18
Step 7: A release branch is made
release/2026.11.18, plus a release PR into main listing “What ships”. When that PR appears, staging is getting the release.bin/release cutMove on whenrelease/2026.11.18exists and the release PR is open. Step 8 starts by itself.Commands
WithAUTO_RELEASEon, this runs when the tests pass on next, asbin/release cut --if-needed.bin/release cutBy hand, for the release lead. Add--dry-runto see the plan first.gh pr list --base mainFind the release PR.Whencutrefuses, it says why: the tests on next aren't green, anotherrelease/*branch is open, the last merge-back hasn't merged, or some changelog lines arrived late and need moving (it lists them). - BotKamal deployson release/2026.11.18 · deployed to staging
Step 8: Staging gets the release
The release is copied to the staging server, a practice copy of the app that the whole team shares.deploy.yml · stagingMove on whenThe deploy run is green. The repository's Environments page shows the commit staging is running. Go to step 9.Commands
WithDEPLOY_STAGINGon, every push to arelease/*branch deploys staging.gh run list --workflow deploy.yml --limit 3The latest deploys. Follow one withgh run watch.bin/kamal logs -d stagingFollow the staging app's logs.bin/kamal deploy -d stagingDeploy staging by hand, when the bot step is off. - Team, you includedThe app on a server · stagingon release/2026.11.18
Step 9: Follow the hand checks on staging
Each item in the release PR's “What ships” list came from a PR. Open the staging app and repeat that PR's hand checks. Start with your own.↺ Found a problem?Fix it, or undo the PR that caused it (a revert), with a PR into the release branch, not next. Staging is deployed again, and the checks start again at step 8.Move on whenEvery PR's checks pass, and the commit you checked is in the release PR's “Commit reviewed on staging” line. The release lead takes step 10.Commands
The release PR's Commits tab lists every PR in the release. Open each one and follow its “What the specs can't show” steps on staging.bin/kamal logs -d stagingWatch for errors while you click.
Fix a problem on the release branch. Its changelog line goes undergit switch -c fix-signup origin/release/2026.11.18 # fix, commit, push gh pr create --base release/2026.11.18## v2026.11.18inCHANGELOG.md, not inchangelog.d/.
Or take a PR out of this release. Also delete its line from the release's changelog section, and list it under “Held back” in the release PR.git switch -c hold-back-search origin/release/2026.11.18 git revert -m 1 <the PR's merge commit> git push -u origin hold-back-search gh pr create --base release/2026.11.18No staging (a new fork's default)? Check the release branch however you test, such as running it withbin/dev, then record its head commit instead.git rev-parse origin/release/2026.11.18The release branch's head commit.bin/release shipoffers the same one when no staging deploy is found. - Production on main
- Release leadrelease_flowmerges release/2026.11.18 into main
Step 10: Ship it
When the checks are done, the release lead runs one command and answers “Ship? y/N”. This merges the release into main, tags itv2026.11.18, and starts step 11.bin/release ship⏸ Shipping can stop hereIf the release changed after staging got it, shipping waits until staging has the new version and it's been checked. The release lead handles it.Move on whenGitHub shows the releasev2026.11.18. Step 12 starts by itself, and so does step 11 whenDEPLOY_PRODUCTIONis on.Commands
bin/release shipShows the release PR and the commit staging ran, then asks “Ship abc1234? [y/N]”.bin/release ship --dry-runShows the plan without shipping.bin/release ship <PR> <commit>Names the PR and the reviewed commit yourself, where nothing can answer the question, as in CI.Stopped partway? Run the same command again. It skips what's already done. If the repo requires approvals, someone other than the author approves the release PR first. - BotKamal deployson main · deployed to users
Step 11: Users get the release
The release is copied to the production server: the real app.deploy.yml · productionMove on whenThe deploy run is green and the app works. Your change is live.Commands
WithDEPLOY_PRODUCTIONon, every change to main deploys production.bin/kamal deployWith it off (a new fork's default), deploy production from your machine after step 10.gh run list --workflow deploy.yml --branch main --limit 1The production deploy. Follow it withgh run watch.bin/kamal logsFollow production's logs.bin/kamal rollback <version>Boots an earlier version again, if this one is broken.bin/kamal app containerslists the versions. It doesn't undo migrations that already ran. - Your change is live.Users have it, in the release tagged
v2026.11.18. A problem found now goes into next like any other PR, or, if users can't wait, it's an urgent fix (below). - Botrelease_flowcopies main into next
Step 12: next is updated to match main
Shipping also opens a merge-back PR (copying main into next) that merges itself, so the next release starts from what users have.merge-back PRMove on whenThe merge-back PR has merged. The nextbin/release cutwaits for it.Commands
Shipping opensmerge-back/2026.11.18into next and turns on auto-merge.gh pr list --base next --head merge-back/2026.11.18Check whether it's still waiting.gh pr update-branch <PR>If next moved before it merged. Keep it a merge commit: a squash leaves main out of next's history.bin/release merge-backOpens one by hand, after an urgent fix or if shipping stopped before this step. - The next release starts again at step 6.
When a switch is off
A new fork starts with all four off. The three variables are under the repository’s Settings → Secrets and variables → Actions → Variables.
| Switch | Off, a new fork’s default | Turning it on |
|---|---|---|
Approvals, set by bin/branch-rules |
A PR merges once its tests pass, with no review at step 4. | Rerun bin/branch-rules without --solo. |
AUTO_RELEASE |
The release lead runs bin/release prepare, then bin/release cut (steps 6–7). |
Also needs a RELEASE_TOKEN secret. |
DEPLOY_STAGING |
There’s no staging. Step 8 is skipped, and step 9 checks the release branch however you test. | Needs a staging server. |
DEPLOY_PRODUCTION |
After step 10, run bin/kamal deploy from your machine. |
Users get main as soon as it changes, which is why only step 10, or an urgent fix, changes main. |
Changing the defaults says how to turn each one on.
Ask on day one
These differ from team to team, so this page can’t answer them.
- Who is our release lead? The person who runs step 10.
- Where is staging? Its web address, for step 9.
- Which switches are on? Run
gh variable list, or see the table above. - Do PRs need an approval here? Solo repos skip step 4’s review.
- Who opens the fix when a staging check fails? The PR’s author, or whoever found it? For step 9.
Urgent fix
When users can’t wait for the next release. It skips staging, so keep it small and get the release lead’s OK first.
git switch -c hotfix/sign-in-loop origin/main
# fix, commit, push
gh pr create --base main
- A fix PR goes straight into main. Add a changelog file as usual; the next release lists it.
- Merging it deploys production when
DEPLOY_PRODUCTIONis on; otherwise runbin/kamal deploy. - No merge-back PR opens this time, so the release lead runs
bin/release merge-backto update next to match main.
If a release branch is open, bring the fix into it as well: a branch from
main, with a PR into release/<name>. Releasing: Hotfix
has the details.
Words you’ll hear
| Word | Meaning |
|---|---|
| next | The branch where merged PRs wait for a release. Nothing on it is live. |
| main | What users are running right now. |
| Release branch | A snapshot of next, named for the day, like release/2026.11.18. |
| Release PR | The PR from a release branch into main. Its “What ships” section lists the changes in the release. |
| Staging | A practice copy of the app on its own server, shared by the team, for checking a release before users see it. |
| Production | The real app that users see. |
| Hand checks | The numbered steps under “What the specs can’t show” in your PR: where to go on staging, what to do, and what to expect. |
| Changelog file | One line in changelog.d/ saying what your PR changes. A release gathers them all. |
| Update branch | GitHub’s button that merges next into your branch so it’s up to date before it can merge. |
| Lefthook | The tool that runs checks on your laptop when you commit or push. |
| CI | The bot that runs the tests on GitHub. Here it’s GitHub Actions. |
| Revert | A PR that undoes another PR’s change. |
| Tag | A permanent label on the commit that shipped, like v2026.11.18, so the team can find it or go back to it. |
| Prepare, cut, ship | The three bin/release commands: name the release, make its branch, send it to users. |
| Merge-back | Copying main into next after a release or an urgent fix, so the two stay the same. |
| Release lead | The person who decides when a release ships and runs bin/release ship (step 10). On a solo repo, that’s you. |
| Kamal | The tool that copies the app to a server and swaps in the new version. |
| release_flow | The gem behind bin/release. |
Releasing has the full rules behind each step.