Skip to content

Commit

Permalink
Fix github release script (#1492)
Browse files Browse the repository at this point in the history
Fixes #1467
  • Loading branch information
visr committed May 24, 2024
1 parent cfbe510 commit a45d8c8
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions utils/github-release.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
import subprocess


def current_git_branch():
result = subprocess.run(
["git", "rev-parse", "--abbrev-ref", "HEAD"],
def git_describe() -> subprocess.CompletedProcess[str]:
return subprocess.run(
["git", "describe", "--tags", "--exact-match"],
capture_output=True,
text=True,
check=True,
)
return result.stdout.strip()


def main():
def main(proc: subprocess.CompletedProcess[str]):
# Get the name of the currently checked out tag
tag_name = subprocess.check_output(
["git", "describe", "--tags", "--exact-match"], text=True
).strip()
tag_name = proc.stdout.strip()

print(f"Currently checked out tag: {tag_name}")

Expand All @@ -36,7 +32,9 @@ def main():


if __name__ == "__main__":
if current_git_branch().startswith("v20"):
main()
proc = git_describe()
if proc.returncode == 0 and proc.stdout.startswith("v20"):
main(proc)
else:
print("Branch doesn't start with 'v20', no release made.")
print("Current checkout is not a tag starting with 'v20', no release made.")
print(proc.stderr)

0 comments on commit a45d8c8

Please sign in to comment.