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 fbefc68
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions release/release.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand Down

0 comments on commit fbefc68

Please sign in to comment.