From c143a64bca88d5915e855b081ceb7758ace6fec7 Mon Sep 17 00:00:00 2001 From: Gabriel Augendre Date: Sat, 21 Aug 2021 19:58:52 +0200 Subject: [PATCH] Autofix version names --- tasks.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tasks.py b/tasks.py index bfc8f2a..26da3a7 100644 --- a/tasks.py +++ b/tasks.py @@ -39,6 +39,7 @@ def release(context, version_name): def tag(context, version_name): """Create & push a git tag""" context: Context + version_name = fix_version_name(version_name) context.run(f"git tag -a {version_name} -m '{version_name}'", echo=True) context.run("git push --follow-tags", echo=True) @@ -46,6 +47,7 @@ def tag(context, version_name): @task def build(context, version_name): """Cross-platform build""" + version_name = fix_version_name(version_name) with ThreadPoolExecutor() as pool: for target in TARGETS: os, arch = target.split("/") @@ -78,3 +80,9 @@ def pre_process(context): with context.cd(BASE_DIR): context.run("go run ./pre_process") + + +def fix_version_name(version_name: str): + if not version_name.startswith("v"): + return f"v{version_name}" + return version_name