Skip to content

Commit 6d38b98

Browse files
committed
Improve getting tags from ref
1 parent fc8f20a commit 6d38b98

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

make_release.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,10 @@ def get_git_branch():
3636

3737
def get_latest_tag():
3838
result = subprocess.run(
39-
["git", "describe", "--tags", "--abbrev=0"], text=True, capture_output=True
39+
["git", "tag", "-l", "--sort=-version:refname"], text=True, capture_output=True
4040
)
41-
return result.stdout.strip()
41+
tags = result.stdout.strip().split("\n")
42+
return tags[0] if tags and tags[0] else None
4243

4344

4445
def get_current_version():
@@ -146,7 +147,7 @@ def main():
146147
print("Welcome to a release maker helper!")
147148
print("First, let's check the branch:\n")
148149
current_branch = get_git_branch()
149-
print(f"\nCurrent branch is: {current_branch} \n")
150+
print(f"Current branch is: {current_branch} \n")
150151

151152
if current_branch not in [BETA_BRANCH, MAIN_BRANCH]:
152153
print("You're not on one of the supported branches!")

0 commit comments

Comments
 (0)