forked from gefyrahq/gefyra
-
Notifications
You must be signed in to change notification settings - Fork 0
/
version.py
37 lines (31 loc) · 915 Bytes
/
version.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
import os
import subprocess
import sys
def set_client_version(part: str):
os.chdir("./client")
subprocess.run(["poetry", "version", part])
version = subprocess.run(
["poetry", "version", "-s"],
capture_output=True,
text=True,
).stdout.rstrip()
subprocess.run(
[
"sed",
"-i",
f's/__VERSION__ = "[^"]*"/__VERSION__ = "{version}"/g',
"gefyra/configuration.py",
]
)
def set_operator_version(part: str):
os.chdir("./operator")
subprocess.run(["poetry", "version", part])
if __name__ == "__main__":
if len(sys.argv) != 2 or sys.argv[1] not in ["major", "minor", "patch"]:
print("Only major, minor, patch is allowed as argument")
exit(1)
else:
wd = os.getcwd()
set_client_version(sys.argv[1])
os.chdir(wd)
set_operator_version(sys.argv[1])