go-semantic-release / semantic-release

📦🚀 semantic-release written in Go
https://go-semantic-release.xyz
MIT License
404 stars 43 forks source link

Prepend new content to CHANGELOG.md #91

Closed Kirbo closed 3 years ago

Kirbo commented 3 years ago

Hi, I'm not sure whether it's an error in my configurations/environment/something, but I noticed that in our use the CHANGELOG.md gets completely rewritten every time a release has been made, thus losing the history of the change log. I mean, only the latest changes in the change log are persistent. I mean, if I currently had only contents of version 0.2.0 in my change log, now I run the semantic-release again and the file contains ONLY the contents of version 0.3.0 and nothing from the versions before this.

If this is expected behaviour, I think adding at least a flag/configuration option for it would be better, so that users could decide whether they wanted to keep the history or have only the latest changes in the file.

christophwitzko commented 3 years ago

Hey @kirbo, you are right. The --changelog flag replaces the existing changelog. I agree with you, we should have a ~--append-changelog~ --prepend-changelog flag 👍

christophwitzko commented 3 years ago

I added a --prepend-changelog flag to semantic-release in v2.10.0👍

Kirbo commented 3 years ago

I added a --prepend-changelog flag to semantic-release in v2.10.0👍

Forgot to mention one thing, which I hope you also had in mind; I think that the prepend-changelog shouldn't affect the release change log, but it should affect only the CHANGELOG.md file. At least in our case, we would want the GitLab/GitHub releases to contain only the changes that were related to the release, not the 100% history of every release, but the CHANGELOG.md file we would like to contain the history of every release.

Or perhaps add a separate flag for this as well, if someone else wants the Releases to contain the whole history as well. I highly doubt that, but it would do no harm for users to have this kind of option(?). Anywho, we wouldn't want to "pollute" the releases with the history of every changes made in previous releases 🙂

Kirbo commented 3 years ago

And thanks for the quick implementation! 🤗

christophwitzko commented 3 years ago

Yes, the --prepend-changelog flag only prepends to the changelog file, not the GitHub/GitLab releases.

Kirbo commented 3 years ago

Yes, the --prepend-changelog flag only prepends to the changelog file, not the GitHub/GitLab releases.

Okay, nice! Thanks again! 🙂