From 9fc429bfe3103059a88aebaba9589dc6afc12c32 Mon Sep 17 00:00:00 2001 From: Grant Gainey Date: Tue, 9 Apr 2024 15:15:59 -0400 Subject: [PATCH] Teach check_release to use tags to define next-version. [noissue] --- .../github/.ci/scripts/check_release.py.j2 | 34 +++---------------- 1 file changed, 5 insertions(+), 29 deletions(-) diff --git a/templates/github/.ci/scripts/check_release.py.j2 b/templates/github/.ci/scripts/check_release.py.j2 index 3b36ac62..3ea39f2c 100755 --- a/templates/github/.ci/scripts/check_release.py.j2 +++ b/templates/github/.ci/scripts/check_release.py.j2 @@ -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!" + 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}, "