1
-
2
1
import argparse
3
2
import logging
4
3
import os
10
9
logging .basicConfig (encoding = "utf-8" , level = logging .INFO )
11
10
12
11
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
+ )
17
24
args = parser .parse_args ()
18
25
19
26
previous_version = args .previous_version
43
50
44
51
# Commit the change
45
52
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" )
55
56
56
57
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" )
65
61
66
62
logging .info ("[client-python] Generating release" )
67
63
os .system ("gren release > /dev/null 2>&1" )
80
76
release_body = release_data ["body" ]
81
77
82
78
logging .info ("[client-python] Generating the new release note" )
83
- if not args .dev :
79
+ if not args .dev :
84
80
github_release_note = requests .post (
85
81
"https://api.github.com/repos/OpenBAS-Platform/client-python/releases/generate-notes" ,
86
82
headers = {
115
111
json = {"body" : new_release_note },
116
112
)
117
113
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
+ )
120
120
121
121
logging .info (
122
122
"[client-python] Release done! Waiting 10 minutes for CI/CD and publication..."
123
123
)
124
124
125
- if not args .dev :
126
- time .sleep (600 )
125
+ if not args .dev :
126
+ time .sleep (600 )
0 commit comments