zestsoftware / zest.releaser

Python software releasing made easy and repeatable
https://zestreleaser.readthedocs.io
GNU General Public License v2.0
198 stars 62 forks source link

Add changelog entries on tag commit #439

Open gforcada opened 7 months ago

gforcada commented 7 months ago

Fixes #218

My main use case here is zest.releaser used together with zestreleaser.towncrier.

Thus the changes here are almost a noop, as the new key added to DATA (history_this_release) is expected to be filled on zestreleaser.towncrier.

For plain zest.releaser use case, we might have to parse the change log file manually to extract that information, right? Or is the history_last_release a good candidate already? 🤔

I was not 100% sure, so that's why I'm creating this PR as a draft.

I'm pushing the zestreleaser.towncrier changes in a bit, stay tuned 📻

reinout commented 7 months ago

When I hear towncrier I cry " @mauritsvanrees " right away. I'm only using manually tweaked changelog entries, Maurits knows more about towncrier I believe.

mauritsvanrees commented 7 months ago

I tried it manually on a test package that does not use towncrier, with gh release create --notes-from-tag v3.0.0 and got this:

https://github.com/mauritsvanrees/mauritstestpackage/releases/tag/v3.0.0

The release note is "Tagging 3.0.0", which is from the tag, so not from the commit message.

I tried a change in zest.releaser which would work without towncrier as well:

$ git diff
diff --git a/zest/releaser/release.py b/zest/releaser/release.py
index cb60697..474bc6b 100644
--- a/zest/releaser/release.py
+++ b/zest/releaser/release.py
@@ -94,6 +94,8 @@ class Releaser(baserelease.Basereleaser):
         )
         self.data["tag-signing"] = self.zest_releaser_config.tag_signing()
         self.data["tag_already_exists"] = self.vcs.tag_exists(tag)
+        self._grab_history()
+        self.data["tag-message"] = self.data["history_last_release"]

     def execute(self):
         """Do the actual releasing"""

With that I released v3.0.4. Ugly, but that could probably be worked around.

gforcada commented 6 months ago

@mauritsvanrees so, would you suggest that the key to use should be tag-message ? 👍🏾 I'm happy with any name, as long as we can get this somehow merged 😄

mauritsvanrees commented 6 months ago

Yes, the tag-message key would seem to work best. This would be done by adapting your PR https://github.com/collective/zestreleaser.towncrier/pull/26, which would mean no changes in zest.releaser itself are needed, if I see it correctly.