Custom Commit Type Release Rules for semantic-release
Configure custom release rules to map non-standard commit types to specific release levels. Override defaults to trigger releases from docs, perf, refactor, and other commit types.
Detailed Explanation
Customizing Release Rules
By default, semantic-release only triggers releases for feat (minor) and fix (patch) commits. You can add custom rules to include other commit types or change the default behavior.
Configuration with Custom Rules
{
"branches": ["main"],
"plugins": [
["@semantic-release/commit-analyzer", {
"preset": "angular",
"releaseRules": [
{"type": "feat", "release": "minor"},
{"type": "fix", "release": "patch"},
{"type": "perf", "release": "patch"},
{"type": "refactor", "release": "patch"},
{"type": "docs", "release": "patch"},
{"type": "style", "release": false},
{"type": "test", "release": false},
{"type": "ci", "release": false},
{"type": "chore", "release": false},
{"type": "revert", "release": "patch"}
]
}],
"@semantic-release/release-notes-generator",
"@semantic-release/npm",
"@semantic-release/github"
]
}
Release Rule Properties
Each rule can match on multiple properties:
| Property | Description | Example |
|---|---|---|
type |
Conventional Commit type | "feat", "fix" |
scope |
Commit scope | "core", "api" |
subject |
Regex pattern for subject | "/^URGENT/" |
release |
Release type or false |
"major", "minor", "patch" |
Scope-Based Rules
You can trigger different release types based on the commit scope:
{"type": "feat", "scope": "api", "release": "major"},
{"type": "feat", "scope": "ui", "release": "minor"}
Disabling Releases for Specific Types
Setting "release": false prevents commits of that type from triggering any release. This is useful for documentation-only changes, test additions, or CI configuration changes that don't affect the published package.
Important Note on Ordering
Rules are evaluated in order. The first matching rule wins. Place more specific rules (with scope) before general rules (without scope).
Use Case
Projects where performance improvements, documentation changes, or refactoring efforts should trigger patch releases to ensure downstream consumers receive the latest improvements, or teams that want fine-grained control over which changes produce releases.
Try It — Semantic Release Config Builder
Related Topics
Basic npm Package Release with semantic-release
Basic Configuration
Using conventionalcommits Preset with semantic-release
Plugin Configuration
Automatic Changelog Generation with semantic-release
Basic Configuration
Prerelease Branch Configuration for semantic-release
Basic Configuration
Scope-Based Release Rules in semantic-release
Specialized Configuration