Reputation: 6862
Can Major version changes (aka Breaking Changes) be handled in semantic-release using the exclamation mark?
git commit -m 'feat!: this is breaking, but is not recognized by semantic-release'
Conventional Commit guidelines show that breaking changes can be labeled in the footer in using an exclamation mark in the header.
This is the workflow that I have been testing
git init
git remote add origin [email protected]:klueless-io/k_genesis.git
git branch -M main
git add .
git commit -am 'first commit'
# Artificial starting version number
git tag v0.0.18 -a -m 'k_genesis initialize repository'
git push -u origin main --tags
git hist
rm a1
git add .
git commit -m 'feat: remove a1'
git hist
npx semantic-release --no-ci
git hist
This does not work as expected
rm a2
git add .
git commit -m 'feat: removed a2
BREAKING CHANGE: break dancing
'
git hist
npx semantic-release --no-ci
rm a3
git add .
git commit -m 'feat!: removed a3 with exclamation in header'
npx semantic-release --no-ci
# Analysis of 1 commits complete: no release
git hist
touch xmen
git add .
git commit -m 'feat: normal feat'
npx semantic-release --no-ci
git hist
I have used the default preset for "@semantic-release/commit-analyzer" (angular) and I have tried a custom preset (conventionalcommits)
{
"branches": [
"main"
],
"plugins": [
"@semantic-release/commit-analyzer", {
"preset": "conventionalcommits"
}
]
}
When I looked at the source code conventional-changelog-conventionalcommits it seamed like breaking change in header should be supported.
Upvotes: 13
Views: 4589
Reputation: 473
You need to manually configure it in .releaserc
:
YAML
branches:
- main
plugins:
- - "@semantic-release/commit-analyzer"
- preset: conventionalcommits
releaseRules:
- type: '*!'
release: major
JSON
{
"branches": [
"main"
],
"plugins": [
[
"@semantic-release/commit-analyzer",
{
"preset": "conventionalcommits",
"releaseRules": [
{
"type": "*!",
"release": "major"
}
]
}
]
]
}
Upvotes: 2