Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add changelog entries on tag commit #439

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

gforcada
Copy link
Contributor

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 📻

Grab the changes that are to be written on the changelog file and write
them as part of the commit message.

This allows to integrate with GitHub release tooling to automatically
grab what's part of a release from the commit message of said release.

This way, while still releasing with `zest.releser` one can nicely
integrate with GitHub releases (and probably GitLab releases as well).
@reinout
Copy link
Collaborator

reinout commented Nov 27, 2023

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
Copy link
Member

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
Copy link
Contributor Author

@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
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use the changelog to generate an better commit message (or annotated tag)
3 participants