This repo uses a lean trunk-based model with short-lived branches.
main(ormaster) is always release-ready.- Work happens in short-lived branches (
feature/*,fix/*,chore/*). - Snapshots are development states with
-SNAPSHOTin Gradleversion. - Releases only happen from
mainvia semantic-release.
main
- Stable mainline branch.
- Every merge should be in a releasable state.
feature/*
- New features.
- Merged into
mainand then deleted.
fix/* or hotfix/*
- Bug fixes.
- Can branch off
mainand merge back directly.
chore/* or docs/* (optional)
- Maintenance or documentation changes.
Snapshots
- Development versions end with
-SNAPSHOT, for example1.2.0-SNAPSHOT. - Feature/fix branches can build at any time without cutting a release.
- The default in
build.gradle.ktsshould usually be a-SNAPSHOTversion. - semantic-release does not create snapshots; snapshots are manual dev versions.
Releases
- semantic-release runs only on
mainand overwritesbuild.gradle.ktswith the release version. - Example:
1.2.0-SNAPSHOTbecomes1.2.0, plus a changelog update. - After a release, the version can be bumped back to the next
-SNAPSHOT(manual or via future automation).
semantic-release uses Conventional Commits in the merge history on main:
- Major release when a commit includes
BREAKING CHANGE:in the footer/body or usestype!, e.g.feat!: remove legacy api. - Minor release for
feat:commits. - Patch release for
fix:commits. - No release for commits that do not match release rules (for example
docs:).
semantic-release can publish pre-releases from dedicated branches. The common setup:
- Create branches like
alpha,beta, andrc. - Mark them as prerelease branches in
.releaserc.json. - Each branch produces versions like
1.3.0-alpha.1,1.3.0-beta.2,1.3.0-rc.1. - When changes are ready, merge into
mainfor the stable release (without the prerelease tag).
Example branch config (in .releaserc.json):
{
"branches": [
"main",
{ "name": "alpha", "prerelease": "alpha" },
{ "name": "beta", "prerelease": "beta" },
{ "name": "rc", "prerelease": "rc" }
]
}gitGraph
commit id: "main: 1.2.0-SNAPSHOT"
branch feature/metrics
commit id: "feat: add metrics (snapshot build)"
checkout main
merge feature/metrics id: "merge feature/metrics"
commit id: "release 1.2.0"
branch fix/critical
commit id: "fix: hot path"
checkout main
merge fix/critical id: "merge fix/critical"
commit id: "release 1.2.1"