alecxe
alecxe

Reputation: 473823

Generate changelog for a semantically released package

Here is the package I'm working on currently.

This is the first time I'm trying to enforce the conventional changelog format and use semantic release versioning. The releasing itself works fine, I'm having travis CI testing, building and publishing the package to npm, creating a new version and a git tag. There is also a GitHub package release created, which is, in a way, a replacement for a separate changelog file.

What I'm trying to achieve next is to automatically generate the ChangeLog based on the latest release changes. From what I understand conventional-changelog can help with that, but whenever I run:

$ conventional-changelog -p eslint-plugin-protractor -i CHANGELOG.md -w -r 0

I'm getting all the changes grouped under the 0.0.0-semantically-released version, which is the stub version I put into the package.json to avoid warnings during npm install.

What am I doing wrong and how can I generate logs for every semantic release version?

Upvotes: 6

Views: 944

Answers (3)

C-Dev
C-Dev

Reputation: 462

As @OAuthMan mentioned, there is a semantic-release changelog plugin and the order of plugin import is important too. Plugins will be executed in the order they are defined during the release step. This order will generate the changelog for you

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

Upvotes: 1

OAuthMan
OAuthMan

Reputation: 21

I think there is a semantic release plugin that does this, https://github.com/semantic-release/changelog, you'll need to add it to the release config in the publish step, or in the plugins array.

Upvotes: 2

code
code

Reputation: 2163

It is working fine for me when I run the following command in your project folder:

conventional-changelog -p eslint-plugin-protractor -i CHANGELOG.md -s -r 0

I have added the contents of the generated CHANGELOG.md to a gist.

Maybe there was a bug with conventional-changelog when you opened this issue?

Upvotes: 3

Related Questions