-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.py
60 lines (45 loc) · 1.37 KB
/
deploy.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import os
import shutil
import subprocess
import git
def check_tag():
repo = git.Repo(os.path.dirname(__file__))
for tag in repo.tags:
if tag.commit == repo.head.commit:
return tag
return None
def main():
tag = check_tag()
if not tag:
print("Current commit is not tagged! Please run bumpversion!")
exit(1)
version = tag.name[1:]
print(f"Deploy version {version}..")
static_path = os.path.join("cato_server", "static")
if os.path.exists(static_path):
print("Clean frontend")
shutil.rmtree("cato_server/static")
print("Building..")
subprocess.check_call("gradlew.bat build -x pythonUnittest -x pythonIntegrationtest")
print("Copy wheel..")
wheel_path = os.path.join(
os.path.dirname(__file__), "dist", f"catoserver-{version}-py3-none-any.whl"
)
shutil.copy(
wheel_path, os.path.join(r"M:\cato\wheels", os.path.basename(wheel_path))
)
pip_path = r"M:\cato\venv\Scripts\pip"
print("Install OpenImageIO..")
subprocess.check_call(
[
pip_path,
"install",
"-r",
os.path.join(os.path.dirname(__file__), "requirements.txt"),
]
)
print("Install..")
subprocess.check_call([pip_path, "install", "--upgrade", wheel_path])
print("Done.")
if __name__ == "__main__":
main()