Search code examples
semantic-release

Why should I specify a branch in semantic-release?


In semantic-release it's possible to specify a branch. For this, the documentation only states:

The branch on which releases should happen.

What effect has this property? What happens if I do not use it? What happens if I use it, and run semantic-release on the specified branch, respectively, what happens if I run it on a different branch?


Solution

  • This option defines the branch from which semantic-release will make releases. If you don't set it it will automatically set to the default: master.

    When semantic-release runs, if the CI job has been triggered on this branch (due to a commit being merged or pushed) it will make a release. IF the CI job was triggered on a different branch, semantic-release will do nothing and log that nothing has to be done as the current branch is not the release branch.