mirror of
https://github.com/UtilitechAS/amsreader-firmware.git
synced 2026-05-02 22:33:41 +00:00
Commit hash as version
This commit is contained in:
@@ -4,8 +4,14 @@ import subprocess
|
|||||||
FILENAME_VERSION_H = 'src/version.h'
|
FILENAME_VERSION_H = 'src/version.h'
|
||||||
version = os.environ.get('GITHUB_TAG')
|
version = os.environ.get('GITHUB_TAG')
|
||||||
if version == None:
|
if version == None:
|
||||||
result = subprocess.run(['git','rev-parse','--short','HEAD'], stdout=subprocess.PIPE)
|
try:
|
||||||
version = result.stdout.decode('utf-8').strip()
|
result = subprocess.run(['git','rev-parse','--short','HEAD'], capture_output=True, check=False)
|
||||||
|
if result.returncode == 0:
|
||||||
|
version = result.stdout.decode('utf-8').strip()
|
||||||
|
else:
|
||||||
|
version = "SNAPSHOT"
|
||||||
|
except:
|
||||||
|
version = "SNAPSHOT"
|
||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user