How to Set Up CI for Release Branches
A release branch freezes a candidate for stabilization while main keeps moving; CI runs heavier checks and packaging there.
When you cut release/x.y, CI should run more than the PR suite: integration tests, packaging, and a deploy to a release or staging environment. Only bug fixes land on the release branch, and they get cherry-picked back to main.
Steps
- Create
release/x.yfrom main when you start stabilizing. - Trigger CI on push to
release/**with the full integration suite. - Build and version the release artifact from that branch.
- Tag and deploy once the branch is green, then merge fixes back to main.
Workflow
.github/workflows/release.yml
on:
push:
branches: ['release/**']
jobs:
release-candidate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm ci
- run: npm run test:integration
- name: Build versioned artifact
run: npm run build && npm pack
- run: ./deploy.sh release-stagingGotchas
- Fixes made only on the release branch and never merged back cause regressions in the next release.
- Keep release branches short-lived; long stabilization windows signal weak trunk quality.
Related guides
How to Map CI to GitFlow BranchesMap CI jobs to GitFlow branches (feature, develop, release, hotfix, main) so each branch type triggers the ri…
How to Run a Release Train With Scheduled Branch CutsRun a release train that cuts a release branch on a fixed cadence, so features that miss the cut simply ride…
How to Run a Hotfix Workflow With Cherry-Pick Back to MainBranch a hotfix from main or a release tag, ship it fast through CI, then cherry-pick the fix back to develop…