Skip to content

Commit db56caf

Browse files
committed
New release workflow
1 parent 06253fc commit db56caf

File tree

1 file changed

+27
-27
lines changed

1 file changed

+27
-27
lines changed

scripts/release.py

+27-27
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
import argparse
32
import logging
43
import os
@@ -10,10 +9,18 @@
109
logging.basicConfig(encoding="utf-8", level=logging.INFO)
1110

1211
parser = argparse.ArgumentParser("release")
13-
parser.add_argument("branch_client_python", help="The new version number of the release.", type=str)
14-
parser.add_argument("previous_version", help="The previous version number of the release.", type=str)
15-
parser.add_argument("new_version", help="The new version number of the release.", type=str)
16-
parser.add_argument("--dev", help="Flag to prevent pushing the release.", action="store_false")
12+
parser.add_argument(
13+
"branch_client_python", help="The new version number of the release.", type=str
14+
)
15+
parser.add_argument(
16+
"previous_version", help="The previous version number of the release.", type=str
17+
)
18+
parser.add_argument(
19+
"new_version", help="The new version number of the release.", type=str
20+
)
21+
parser.add_argument(
22+
"--dev", help="Flag to prevent pushing the release.", action="store_false"
23+
)
1724
args = parser.parse_args()
1825

1926
previous_version = args.previous_version
@@ -43,25 +50,14 @@
4350

4451
# Commit the change
4552
logging.info("[client-python] Pushing to " + branch_client_python)
46-
os.system(
47-
'git commit -a -m "[client] Release '
48-
+ new_version
49-
+ '" > /dev/null 2>&1')
50-
if not args.dev :
51-
os.system('git push origin '
52-
+ branch_client_python
53-
+ " > /dev/null 2>&1"
54-
)
53+
os.system('git commit -a -m "[client] Release ' + new_version + '" > /dev/null 2>&1')
54+
if not args.dev:
55+
os.system("git push origin " + branch_client_python + " > /dev/null 2>&1")
5556

5657
logging.info("[client-python] Tagging")
57-
os.system(
58-
"git tag -f "
59-
+ new_version
60-
)
61-
if not args.dev :
62-
os.system(
63-
"git push -f --tags > /dev/null 2>&1"
64-
)
58+
os.system("git tag -f " + new_version)
59+
if not args.dev:
60+
os.system("git push -f --tags > /dev/null 2>&1")
6561

6662
logging.info("[client-python] Generating release")
6763
os.system("gren release > /dev/null 2>&1")
@@ -80,7 +76,7 @@
8076
release_body = release_data["body"]
8177

8278
logging.info("[client-python] Generating the new release note")
83-
if not args.dev :
79+
if not args.dev:
8480
github_release_note = requests.post(
8581
"https://api.github.com/repos/OpenBAS-Platform/client-python/releases/generate-notes",
8682
headers={
@@ -115,12 +111,16 @@
115111
json={"body": new_release_note},
116112
)
117113

118-
if not args.dev :
119-
closeRelease("https://api.github.com/repos/OpenBAS-Platform/client-python", new_version, github_token)
114+
if not args.dev:
115+
closeRelease(
116+
"https://api.github.com/repos/OpenBAS-Platform/client-python",
117+
new_version,
118+
github_token,
119+
)
120120

121121
logging.info(
122122
"[client-python] Release done! Waiting 10 minutes for CI/CD and publication..."
123123
)
124124

125-
if not args.dev :
126-
time.sleep(600)
125+
if not args.dev:
126+
time.sleep(600)

0 commit comments

Comments
 (0)