Reputation: 4323
I would like to add a check to semantic-release to only allow it to publish minor and patch releases. If it detects the need to perform a new major release, I want the process to be aborted and fail (instead of proceeding to perform the release). How can I do this?
Upvotes: 1
Views: 436
Reputation: 1887
I have created an npm package for a plugin that does this.
evelynhathaway/semantic-release-fail-on-major-bump
npm install --save-dev semantic-release-fail-on-major-bump
.releaserc
{
"plugins": [
"semantic-release-fail-on-major-bump",
]
}
If the published package doesn't solve your specific needs, you can create a semantic-release plugin that implements the verifyRelease
step and throws an error based on the next release type.
plugin/index.js
function verifyRelease (pluginConfig, context) {
if (context.nextRelease.type === "major") {
throw new Error("We cannot publish breaking changes at this time.");
}
}
module.exports = {verifyRelease};
Learn how to make semantic-release plugins
Upvotes: 2