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

Adds towncrier, a tool for changelog generation #9803

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

Conversation

wgreenberg
Copy link
Collaborator

This lets us generate a categorized changelog automagically from text snippets in the new newsfragments directory. The suffix of each of these plaintext files determines the category (fix, doc, misc, etc).

More info at https://towncrier.readthedocs.io

Fixes #8272

@wgreenberg
Copy link
Collaborator Author

wgreenberg commented Oct 13, 2023

Example output from towncrier build:

# Certbot change log

Certbot adheres to [Semantic Versioning](https://semver.org/).

## 2.8.0.dev0 - 2023-10-13
==========================

### Improved Documentation

- Added towncrier (https://towncrier.readthedocs.io) for automatic changelog generation. [#8272](https://github.com/certbot/certbot/issues/8272)


### Deprecations and Removals

- Drop Python 3.7 support [#9792](https://github.com/certbot/certbot/issues/9792)

Note that in an actual release, the .dev0 suffix would've already been removed by the release script

@wgreenberg wgreenberg force-pushed the fix-8272 branch 2 times, most recently from 27f63d4 to 8cc2210 Compare October 16, 2023 19:07
This lets us generate a categorized changelog automagically from
text snippets in the new newsfragments directory. The suffix of
each of these plaintext files determines the category (fix, doc, misc,
etc).

More info at https://towncrier.readthedocs.io
Copy link
Member

@bmw bmw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think an approach like this is definitely promising! Thanks for playing with it.

If you want to keep working on this, in addition to my inline comments, I think we might want to:

  • Consider adding a gitignore file to stop git from deleting the newsfragments directory.
  • Update any dev docs like our PR template instructing people how to use the new system.
  • Make sure the newsfragments and CHANGELOG.md are currently in sync with master before this is merged.

I'd suggest we wait to do this until we're about ready to merge this to do this last one, but I'm saying it now to help you/I remember.

package = "certbot"
directory = "newsfragments"
filename = "CHANGELOG.md"
template = "tools/changelog_template.jinja"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the purpose of this template? I had to run pip install -U towncrier in my virtual environment to get it to work, but after doing that and comparing the output of towncrier build --draft, it doesn't seem to be having an effect? Is this what you're seeing too?

Comment on lines +201 to 202
towncrier build
git add certbot/CHANGELOG.md
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we'd need want further changes in this file right? At first I thought we just might to add --yes to build to automatically delete newsfragments, but I think it's more than that.

The changelog is essentially modified twice in this script as the script is in master. We first fix up the running .dev0 changelog for the release and then we add the running changelog for our next release in the section of the script I'm commenting on here.

I think we'd essentially want to delete everything here and then use towncrier for the first set of changelog modifications right? This is totally doable, but I think it takes some refactoring as those changelog modifications are currently done before the version number is updated and our release instructions tell you to deactivate the virtual environment before running the release so the person doing the release probably doesn't have towncrier installed.

If you decide to play with this more, you can do test releases by following the release instructions where you can set RELEASE_GPG_KEY to some random key rather than using the trusted key.

@@ -198,15 +198,7 @@ while ! git commit --gpg-sign="$RELEASE_GPG_KEY" -m "Release $version"; do
done
git tag --local-user "$RELEASE_GPG_KEY" --sign --message "Release $version" "$tag"

# Add master section to CHANGELOG.md
header=$(head -n 4 certbot/CHANGELOG.md)
body=$(sed s/nextversion/$nextversion/ tools/_changelog_top.txt)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With this change, I think we can also delete tools/_changelog_top.txt 🎉

@bmw bmw assigned wgreenberg and bmw Nov 3, 2023
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.

Prevent merge conflicts and changelog entries being added to the wrong release
2 participants