forked from Abdur-rahmaanJ/shopcube
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpublish.py
28 lines (24 loc) · 887 Bytes
/
publish.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
import sys
import subprocess
import argparse
parser = argparse.ArgumentParser(description="Publish commands")
parser.add_argument("commit_message", help="commit message")
parser.add_argument(
"--pypi", help="publish to Pypi also", action="store_true"
) # flag only
parser.add_argument(
"--pypionly", help="publish to Pypi only", action="store_true"
) # flag only
args = parser.parse_args()
build_docs = ["sphinx-build", "-b", "html", "sphinx_source", "docs"]
add_all = ["git", "add", "*"]
commit = ["git", "commit", "-m", "{}".format(args.commit_message)]
push_github = ["git", "push", "origin", "dev"]
push_pypi = [sys.executable, "setup.py", "publish"]
commands = [build_docs, add_all, commit, push_github]
if args.pypi:
commands += [push_pypi]
if args.pypionly:
commands = [push_pypi]
for command in commands:
subprocess.run(command, stdout=subprocess.PIPE)