Skip to content

Commit 56019df

Browse files
committed
get the tag from git tag or current date
1 parent 7e8892f commit 56019df

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

build.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,27 @@
1515

1616
import requests
1717

18+
19+
def get_current_version():
20+
path = os.getcwd()
21+
procs = subprocess.run(
22+
[
23+
"git",
24+
"describe",
25+
"--tags",
26+
"--exact-match",
27+
],
28+
stdout=subprocess.PIPE,
29+
stderr=subprocess.PIPE,
30+
cwd=path,
31+
)
32+
if procs.returncode != 0:
33+
return None
34+
return procs.stdout.decode("utf8").strip()
35+
36+
1837
# the date tag for the generated files and stuff
19-
TAG = datetime.date.today().strftime("%Y%m%d")
38+
TAG = get_current_version() or datetime.date.today().strftime("%Y%m%d")
2039
# the dirs for putting the things in it
2140
BUILD_DIR = "_build"
2241
BUILD_DEPS = os.path.join(BUILD_DIR, "deps")

0 commit comments

Comments
 (0)