ci: fetch tags before guessing latest version

This commit is contained in:
jo 2023-06-13 10:27:43 +02:00
commit f811ce6adb
No known key found for this signature in database
GPG key ID: B2FEC9B22722B984

View file

@ -67,15 +67,17 @@ class Metadata(TypedDict):
"""
def sh(cmd: str):
def sh(cmd: str, **kwargs):
logger.debug("running command: %s", cmd)
return check_output(shlex.split(cmd), text=True).strip()
return check_output(shlex.split(cmd), text=True, **kwargs).strip()
def latest_tag_on_branch() -> str:
"""
Return the latest tag on the current branch.
"""
if "CI" in os.environ:
sh("git fetch origin --tags")
return sh("git describe --tags --abbrev=0")