Skip to content

Commit

Permalink
Undo changes to changelog for rc
Browse files Browse the repository at this point in the history
  • Loading branch information
wkoot committed Jun 11, 2024
1 parent 1c9d409 commit baac91b
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions release/release.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,26 @@ 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 bump == "rc":
cmd.append("pre_release_number") # Bump the release candidate number, when already on a -rc version
else:
cmd.append(bump)
if create_rc:
cmd.append("--no-tag") # Don't tag last commit, because it will be amended
subprocess.run(cmd, check=True)
if create_rc:
changelog_path = "../docs/src/changelog.md"
subprocess.run(("git", "checkout", "HEAD~1", "--", changelog_path), check=True)
subprocess.run(("git", "add", changelog_path), 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)


Expand Down

0 comments on commit baac91b

Please sign in to comment.