-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathpush.py
More file actions
50 lines (45 loc) · 1.43 KB
/
Copy pathpush.py
File metadata and controls
50 lines (45 loc) · 1.43 KB
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
import subprocess
import sys
def run(cmd, capture=False):
"""Run a command, optionally capturing stderr. All goes to terminal."""
kwargs = {}
if capture:
kwargs["stderr"] = subprocess.PIPE
kwargs["stdout"] = subprocess.PIPE
kwargs["text"] = True
result = subprocess.run(cmd, shell=True, **kwargs)
if result.returncode != 0:
err = result.stderr.strip() if result.stderr else ""
out = result.stdout.strip() if result.stdout else ""
print(err or out or "command failed")
return result.returncode
else:
return subprocess.run(cmd, shell=True).returncode
print("----------------------")
print("| TQSync Auto Pusher |")
print("----------------------")
print("1.版本号处理")
print("major,minor,patch")
bump_type = input("what do u want to bump: ")
if bump_type == "major":
run("python ./utils/version_bumper.py -major")
elif bump_type == "minor":
run("python ./utils/version_bumper.py -minor")
elif bump_type == "patch":
run("python ./utils/version_bumper.py -patch")
else:
print("输入为空,未做版本号更改")
print("2.Git Commit")
ret = run("git add .")
if ret != 0:
print("git add failed")
sys.exit(1)
ret = run("git commit")
if ret != 0:
print("git commit failed (commit aborted or no changes)")
sys.exit(1)
print("3.Git Push")
ret = run("git push")
if ret != 0:
print("git push failed")
sys.exit(1)