From fbefc6834d3f9ee67af9bfacaae01755331fe7e5 Mon Sep 17 00:00:00 2001 From: wkoot <3715211+wkoot@users.noreply.github.com> Date: Tue, 11 Jun 2024 12:43:44 +0200 Subject: [PATCH] Undo changes to changelog for rc --- release/release.py | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/release/release.py b/release/release.py index 0abd78c993..8c2442ae68 100755 --- a/release/release.py +++ b/release/release.py @@ -138,14 +138,25 @@ def main() -> None: if bump.startswith("rc-"): create_rc = True bump = bump.split("-", maxsplit=1)[1] # Create a patch, minor, or major release candidate - elif bump == "drop-rc": - bump = "pre_release_label" # Bump the pre-release label from "rc" to "final" (which is optional and omitted) - elif bump == "rc": - bump = "pre_release_number" # Bump the release candidate number check_preconditions(bump, current_version, create_rc) if check_preconditions_only: return - subprocess.run(("bump-my-version", "bump", bump), check=True) + cmd = ["bump-my-version", "bump"] + if bump == "drop-rc": + cmd.append("pre_release_label") # Bump the pre-release label from "rc" to "final" (being optional and omitted) + elif create_rc: + cmd.append("pre_release_label rc") # Bump the pre-release label to "rc" + cmd.append("pre_release_number") # Bump the release candidate number + cmd.append("--no-tag") # Don't tag last commit, because it will be amended + else: + cmd.append(bump) + subprocess.run(cmd, check=True) + if create_rc: + subprocess.run(("git", "checkout", "HEAD~1", "--", "../docs/src/changelog.md"), check=True) + subprocess.run(("git", "add", "../docs/src/changelog.md"), check=True) + amend_output = subprocess.run(("git", "commit", "--amend", "--no-edit"), check=True, capture_output=True) + rc_tag_name = amend_output.stdout.split(b"\n")[0].split(b" ")[-1] # the last word of the first output line + subprocess.run(("git", "tag", rc_tag_name), check=True) # set the rc tag on the amended commit subprocess.run(("git", "push", "--follow-tags"), check=True)