release-monorepo-semantically
v1.8.0
Published
cli commands to manage versioning of package in monorepo and generate changelog
Readme
monorepo-semantic-release
CLI for semantic versioning and release automation in pnpm monorepos.
It discovers workspace packages, analyzes conventional commits per package scope, bumps versions in dependency order, updates internal dependency versions, generates changelogs, creates a release commit and tags, optionally creates GitHub Releases, and publishes to npm.
Requirements
- Node.js:
>=22 <23 - pnpm:
10.20.0 - Git repository with conventional commits
Installation
pnpm add -D release-monorepo-semanticallyRun from your monorepo root:
pnpm monorepo-semantic-releaseCommit conventions
Release-triggering commits:
feat(scope): ...->minorfix(scope): ...->patchperf(scope): ...->patchBREAKING CHANGEor!->major
Non-release types: docs, test, ci, chore, refactor, style.
Package scope is matched by package name.
Release flow
- Discover workspace packages from root
package.jsonworkspaces. - Exclude private packages.
- Sort packages so dependencies are processed first.
- Read commits since
<package-name>@<version>tag. - Compute bump type (
major > minor > patch > none). - Update package versions and internal dependency versions.
- Render changelog entries.
- Create one release commit and per-package tags.
- Push commit/tags (unless disabled).
- Create GitHub Releases (if configured).
- Publish released packages (unless disabled).
CLI options
monorepo-semantic-release [options]
Options:
--dry-run Preview changes without mutating files/git/publish
--no-push Skip git push
--no-publish Skip npm publish
--changelog-template <path> Override changelog template
--release-commit-template <path> Override release commit template
-h, --help Show helpTemplate overrides
You can override templates via CLI options, a root package.json section, or .semantic-release.json.
package.json:
{
"release": {
"releaseTemplates": {
"changelogTemplate": "templates/changelog.hbs",
"releaseCommitTemplate": "templates/release-commit-msg.hbs"
}
}
}.semantic-release.json:
{
"releaseTemplates": {
"changelogTemplate": "templates/changelog.hbs",
"releaseCommitTemplate": "templates/release-commit-msg.hbs"
}
}Precedence (highest to lowest): CLI flags, .semantic-release.json, package.json config, built-in defaults.
Built-in templates:
templates/changelog.hbstemplates/release-commit-msg.hbstemplates/github-release-notes.hbs
GitHub Releases
GitHub release creation runs only when all conditions are met:
GITHUB_ACTIONS=trueGITHUB_REPOSITORYis set (for exampleowner/repo)GITHUB_TOKENis setghCLI is available- not
--dry-run - not
--no-push
Each released package creates a release:
- tag:
<package-name>@<version> - title:
<package-name> v<version> - notes rendered from
templates/github-release-notes.hbs
Plugin architecture
Release lifecycle is implemented by plugins:
PackageJsonPlugin: updates internal dependency versions inpackage.jsonChangelogPlugin: writes per-package changelog updatesGitPlugin: creates release commit, tags, and pushGithubPlugin: creates GitHub ReleasesNpmPlugin: bumps package version and publishes
Plugin selection and order
You can choose which plugins run and in what order with plugins.
package.json:
{
"release": {
"plugins": [
{ "name": "package-json" },
{ "name": "changelog", "template": "templates/changelog.hbs" },
{ "name": "git", "template": "templates/release-commit-msg.hbs" },
{ "name": "github", "template": "templates/github-release-notes.hbs" },
{ "name": "npm" }
]
}
}.semantic-release.json:
{
"plugins": [
{ "name": "package-json" },
{ "name": "changelog", "template": "templates/changelog.hbs" },
{ "name": "git", "template": "templates/release-commit-msg.hbs" },
{ "name": "github", "template": "templates/github-release-notes.hbs" },
{ "name": "npm" }
]
}Default order: ["package-json", "changelog", "git", "github", "npm"].
For changelog, git, and github plugins, template is required.
Development
pnpm install
pnpm run build
pnpm test
pnpm run test:e2e
pnpm run lintNotes
- Internal monorepo dependencies are written as exact versions.
- Tag format is fixed:
<package-name>@<version>. - In
--dry-run, no files/git/releases/publish actions are performed.
