Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Teach check_release to use tags to define next-version. #858

Merged
merged 1 commit into from
Apr 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 5 additions & 29 deletions templates/github/.ci/scripts/check_release.py.j2
Original file line number Diff line number Diff line change
Expand Up @@ -77,35 +77,11 @@ def main():
f"{last_tag}", f"origin/{branch}", "--name-only", "--", "requirements.txt"
)
if z_changelog or req_txt_diff:
# Blobless clone does not have file contents for Z branches,
# check commit message for last Z bump
git_branch = f"origin/{branch}"
next_version = None
bump_commit = repo.git.log(
"--oneline",
"--grep=Bump version",
"-n 1",
git_branch,
"--",
".bumpversion.cfg",
)
if bump_commit:
next_version = bump_commit.split("→ ")[-1]
# If not found - try old-commit-msg
if not next_version:
bump_commit = repo.git.log(
"--oneline",
"--grep=Bump to",
"-n 1",
git_branch,
"--",
".bumpversion.cfg",
)
next_version = bump_commit.split("to ")[-1] if bump_commit else None

# You could, theoretically, be next_vers==None here - but that's always
# been true for this script.
next_version = Version(next_version)
curr_version = Version(last_tag)
assert curr_version.base_version.startswith(
branch
), "Current-version has to belong to the current branch!"
Comment on lines +81 to +83
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

next_version = Version(f"{branch}.{curr_version.micro + 1}")
reason = "CHANGES" if z_changelog else "requirements.txt"
print(
f"A Z-release is needed for {branch}, "
Expand Down
Loading