TRX/tools/shared/versioning.py
Marcin Kurczewski 135f876e51
build: include current version in the changelog
When only the assets of a pre-release change, GitHub webhooks do not
send out a release event. This change forces the pre-release description
text to change with every release, so that we get notifications about
new builds on Discord.

Also, change the asset names to not include spaces.
2024-04-24 22:18:24 +02:00

27 lines
575 B
Python

from subprocess import run
from shared.common import SRC_DIR
def get_branch_version(branch: str | None) -> str:
return run(
[
"git",
"describe",
*([branch] if branch else ["--dirty"]),
"--always",
"--abbrev=7",
"--tags",
"--exclude",
"latest",
],
cwd=SRC_DIR,
text=True,
capture_output=True,
check=False,
).stdout.strip()
def generate_version() -> str:
version = get_branch_version(None)
return version or "?"