diff options
author | Richard van der Hoff <richard@matrix.org> | 2022-03-04 22:40:51 +0000 |
---|---|---|
committer | Richard van der Hoff <richard@matrix.org> | 2022-03-04 22:40:51 +0000 |
commit | 00a67f831adc7c01fcced6269cb5790816252493 (patch) | |
tree | 61c126514e6a1c8ebe81bd5ac38efe51e622b26a /scripts-dev | |
parent | Reduce to-device queries for /sync. (#12163) (diff) | |
parent | Relax version guard for packaging (#12166) (diff) | |
download | synapse-00a67f831adc7c01fcced6269cb5790816252493.tar.xz |
Merge remote-tracking branch 'origin/release-v1.54' into develop
Diffstat (limited to 'scripts-dev')
-rwxr-xr-x | scripts-dev/release.py | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/scripts-dev/release.py b/scripts-dev/release.py index 4e1f99fee4..046453e65f 100755 --- a/scripts-dev/release.py +++ b/scripts-dev/release.py @@ -17,6 +17,8 @@ """An interactive script for doing a release. See `cli()` below. """ +import glob +import os import re import subprocess import sys @@ -209,8 +211,8 @@ def prepare(): with open("synapse/__init__.py", "w") as f: f.write(parsed_synapse_ast.dumps()) - # Generate changelogs - run_until_successful("python3 -m towncrier", shell=True) + # Generate changelogs. + generate_and_write_changelog(current_version) # Generate debian changelogs if parsed_new_version.pre is not None: @@ -523,5 +525,29 @@ def get_changes_for_version(wanted_version: version.Version) -> str: return "\n".join(version_changelog) +def generate_and_write_changelog(current_version: version.Version): + # We do this by getting a draft so that we can edit it before writing to the + # changelog. + result = run_until_successful( + "python3 -m towncrier --draft", shell=True, capture_output=True + ) + new_changes = result.stdout.decode("utf-8") + new_changes = new_changes.replace( + "No significant changes.", f"No significant changes since {current_version}." + ) + + # Prepend changes to changelog + with open("CHANGES.md", "r+") as f: + existing_content = f.read() + f.seek(0, 0) + f.write(new_changes) + f.write("\n") + f.write(existing_content) + + # Remove all the news fragments + for f in glob.iglob("changelog.d/*.*"): + os.remove(f) + + if __name__ == "__main__": cli() |