Prerelease Branch Configuration for semantic-release
Configure semantic-release with multiple release channels including beta, alpha, and next branches. Publish prerelease versions like 1.0.0-beta.1 from non-main branches.
Detailed Explanation
Multi-Branch Prerelease Configuration
semantic-release supports multiple release channels, allowing you to publish prerelease versions from feature branches while keeping stable releases on main.
Configuration
{
"branches": [
"main",
{"name": "next", "prerelease": true},
{"name": "beta", "prerelease": true},
{"name": "alpha", "prerelease": true}
],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/npm",
"@semantic-release/github"
]
}
How Prerelease Versions Work
Each branch produces different version numbers:
| Branch | Example Version | npm Tag |
|---|---|---|
| main | 1.2.0 | latest |
| next | 1.3.0-next.1 | next |
| beta | 1.3.0-beta.1 | beta |
| alpha | 1.3.0-alpha.1 | alpha |
Distribution Tags
When publishing to npm, each branch publishes under its own distribution tag. Users install specific channels with:
npm install my-package # latest (main)
npm install my-package@next # next channel
npm install my-package@beta # beta channel
Channel vs. Prerelease
- channel controls the npm dist-tag used for publishing
- prerelease adds a prerelease identifier to the version number
When prerelease is set to true, the branch name is used as the identifier. You can also set it to a custom string like "rc" to get versions like 1.3.0-rc.1.
Promotion Flow
Features flow through branches: alpha -> beta -> next -> main. When you merge next into main, semantic-release creates a stable release from the prerelease version.
Use Case
Libraries and frameworks that need staged rollouts — testing features in alpha, stabilizing in beta, and promoting to stable release. Popular with open-source projects where community feedback is gathered during prerelease phases.
Try It — Semantic Release Config Builder
Related Topics
Basic npm Package Release with semantic-release
Basic Configuration
Maintenance Branch Configuration for semantic-release
Specialized Configuration
Custom Commit Type Release Rules for semantic-release
Advanced Configuration
Automatic Changelog Generation with semantic-release
Basic Configuration
Publishing Scoped npm Packages with semantic-release
Plugin Configuration