version based on current tag for makefile

if there isnt a tag, version is 'git'. this fixes versioning for aur package and docker.
This commit is contained in:
Harvey Tindall
2020-09-15 12:12:51 +01:00
parent 500ecac95d
commit 258656fbf9
2 changed files with 8 additions and 1 deletions
+7
View File
@@ -6,6 +6,13 @@ try:
except IndexError:
version = "git"
if version == "auto":
try:
version = subprocess.check_output("git describe --exact-match HEAD".split()).decode("utf-8").rstrip().replace('v', '')
except subprocess.CalledProcessError as e:
if e.returncode == 128:
version = "git"
commit = subprocess.check_output("git rev-parse --short HEAD".split()).decode("utf-8").rstrip()
file = f'package main; const VERSION = "{version}"; const COMMIT = "{commit}";'