5
5
def main ():
6
6
build = Properties ()
7
7
with open ('build.properties' , 'rb' ) as f :
8
- build .load (f , "utf-8" )
8
+ build .load (f , "utf-8" )
9
9
10
10
mc_version , mcv_meta = build ['mc_version' ]
11
11
version , v_meta = build ['version' ]
@@ -15,18 +15,25 @@ def main():
15
15
print ('Version:' , version )
16
16
print ('Build Number' , build_number )
17
17
18
- changelog = '-m "Changelog:" '
18
+ changelog = ''
19
19
with open ('changelog.txt' , 'r' ) as f :
20
20
content = f .read ()
21
+ content = content .replace ('"' , '\' ' )
22
+ lines = content .splitlines ()
23
+ for line in lines :
24
+ changelog = changelog + '-m "' + line + '" '
25
+
26
+ tag_success = os .system ('git tag -a release-{}-{}-{} {}' .format (mc_version , version , build_number , changelog ))
27
+
28
+ if tag_success != 0 :
29
+ print ('Failed to create tag' )
30
+ return
31
+ else :
32
+ print ('Created tag' )
21
33
22
- content = content .replace ('"' , '\' ' );
23
- changelog = changelog + re .sub (r'(- .+)\n?' , '-m "\g<1>" ' , content )
24
-
25
- os .system ('git tag -a release-{}-{}-{} {}' .format (mc_version , version , build_number , changelog ))
26
-
27
34
build ['build_number' ] = str (int (build_number ) + 1 )
28
35
with open ("build.properties" , "wb" ) as f :
29
- build .store (f , encoding = "utf-8" )
36
+ build .store (f , encoding = "utf-8" )
30
37
31
38
os .system ('git commit -a -m build' )
32
39
os .system ('git push origin master release-{}-{}-{}' .format (mc_version , version , build_number ))
0 commit comments