From 3758adba9e1ad6c173d5f2d460d8f9bb9cc1996a Mon Sep 17 00:00:00 2001 From: Chris Pyles Date: Sat, 9 Mar 2024 11:11:14 -0800 Subject: [PATCH] update release.py to remove unreleased label from changelog entries --- CHANGELOG.md | 2 +- release.py | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a202f512..76baf6d11 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -**v5.5.0 (unreleased):** +**v5.5.0:** * Suppress all warnings when running `otter.check.validate_export` as a module per [#735](https://github.com/ucbds-infra/otter-grader/issues/735) * Updated default version of `ottr` to v1.5.0 diff --git a/release.py b/release.py index bc59842e6..fe944e1fd 100644 --- a/release.py +++ b/release.py @@ -116,5 +116,17 @@ print(f"Versions updated. Release commit hash is {new_hash} -- commit and push to release") sys.exit() - else: - print(f"Versions updated. Release version is {new_version_number}") + print(f"Versions updated. Release version is {new_version_number}") + + if to_beta: + sys.exit() + + print("Updating CHANGELOG.md") + with open("CHANGELOG.md") as f: + cl = f.read() + + new_version_regex = new_version_number.replace(".", r"\.") + cl = re.sub(fr"{new_version_regex}\s*\(unreleased\)", new_version_number, cl, flags = re.IGNORECASE) + + with open("CHANGELOG.md", "w") as f: + f.write(cl)