-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.py
34 lines (25 loc) · 1.17 KB
/
build.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import os
import subprocess
cmd = subprocess.run(["git", "describe", "--abbrev=0"], stdout=subprocess.PIPE)
version: str = cmd.stdout.decode("utf-8")
version = version.strip()
with open("version.py", "w", encoding="utf8", errors="ignore") as f:
f.write("version = \"{}\"".format(version))
print("::set-output name=version::{}".format(version))
properties_file_content = ""
with open("build_properties_template.txt", 'r', encoding='utf8', errors='ignore') as f:
properties_file_content = f.read()
properties_file_content = properties_file_content.replace("x.x.x.x", version)
with open("tmp_build_properties.txt", 'w', encoding='utf8') as f:
f.write(properties_file_content)
os.system("pyinstaller --onefile main.py --version-file=\"tmp_build_properties.txt\"")
filename = "./dist/tabletop-turkeyifier.exe"
if os.path.isfile(filename):
os.remove(filename)
os.rename("./dist/main.exe", filename)
os.system("pyinstaller --onefile updater.py --version-file=\"tmp_build_properties.txt\"")
filename = "./dist/tabletop-turkeyifier-updater.exe"
if os.path.isfile(filename):
os.remove(filename)
os.rename("./dist/updater.exe", filename)
os.remove("tmp_build_properties.txt")