mirror of https://github.com/hrfee/jfa-go
when using makefile, version is set to "git". Currently printed on start, but an about page in the web UI will be added.pull/20/head
parent
6e3d5dac19
commit
1b0ca34586
@ -0,0 +1,20 @@
|
||||
import subprocess
|
||||
import sys
|
||||
import os
|
||||
try:
|
||||
version = sys.argv[1].replace('v', '')
|
||||
except IndexError:
|
||||
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}";'
|
||||
|
||||
try:
|
||||
writeto = sys.argv[2]
|
||||
except IndexError:
|
||||
writeto = "version.go"
|
||||
|
||||
with open(writeto, 'w') as f:
|
||||
f.write(file)
|
||||
|
Loading…
Reference in new issue