-
Notifications
You must be signed in to change notification settings - Fork 21
/
push_tag.py
35 lines (26 loc) · 999 Bytes
/
push_tag.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
29
30
31
32
33
34
35
import os
import re
from jproperties import Properties
def main():
build = Properties()
with open('build.properties', 'rb') as f:
build.load(f , "utf-8")
mc_version, mcv_meta = build['mc_version']
version, v_meta = build['version']
build_number, bn_meta = build['build_number']
print('MC Version:', mc_version)
print('Version:', version)
print('Build Number', build_number)
changelog = '-m "Changelog:" '
with open('changelog.txt', 'r') as f:
content = f.read()
content = content.replace('"', '\'');
changelog = changelog + re.sub(r'(- .+)\n?', '-m "\g<1>" ', content)
os.system('git tag -a release-{}-{}-{} {}'.format(mc_version, version, build_number, changelog))
build['build_number'] = str(int(build_number) + 1)
with open("build.properties", "wb") as f:
build.store(f, encoding="utf-8")
os.system('git commit -a -m build')
os.system('git push origin master release-{}-{}-{}'.format(mc_version, version, build_number))
if __name__ == '__main__':
main()