1

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?

Pedro A
  • 3,989
  • 3
  • 32
  • 56

1 Answers1

2

Existing Plugin

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",
    ]
}

Custom Plugin

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

evelynhathaway
  • 1,670
  • 14
  • 18