Mr.X
Mr.X

Reputation: 31305

Automated change logs not generating with semantic-release on a non-master branch

In my node project - I'm trying to implement semantic-release to generate release notes in the form of the changelogs, bump the project version number.

The same is installed in the project following the below command:

npm i -D semantic-release@next @semantic-release/git@next @semantic-release/commit-analyzer@next @semantic-release/release-notes-generator@next @semantic-release/npm@next @semantic-release/changelog@next

Here is the configuration in the package.json file:

"release": {
    "branches": [
      "qa"
    ],
    "plugins": [
      "@semantic-release/commit-analyzer",
      "@semantic-release/release-notes-generator",
      "@semantic-release/changelog",
      "@semantic-release/git"
    ]
  }

However, when I try to run npx semantic-release --no-ci to execute it throws this:

This test run was triggered on the branch qa, while semantic-release is configured to only publish from master, therefore a new version won’t be published.

The entire stack trace is:

ℹ  Running semantic-release version 15.14.0
✔  Loaded plugin "verifyConditions" from "@semantic-release/changelog"
✔  Loaded plugin "verifyConditions" from "@semantic-release/git"
✔  Loaded plugin "analyzeCommits" from "@semantic-release/commit-analyzer"
✔  Loaded plugin "generateNotes" from "@semantic-release/release-notes-generator"
✔  Loaded plugin "prepare" from "@semantic-release/changelog"
✔  Loaded plugin "prepare" from "@semantic-release/git"
ℹ  This test run was triggered on the branch qa, while semantic-release is configured to only publish from master, therefore a new version won’t be published.

The conventional commits are done on the QA branch - I need to generate the changelog on the QA branch.

What is the right approach?

Upvotes: 1

Views: 1082

Answers (1)

L. Lenz
L. Lenz

Reputation: 121

I am not 100 percent sure but the enhanced branch definition is:

branches: [
  {name: 'qa', prerelease: false}
]

As the changelog is generated when using the --branch flag it is possible that the branches definition in your config file is wrong.

You could try to configure the branch using the enhanced statement I suggested.

Upvotes: 1

Related Questions