-
Notifications
You must be signed in to change notification settings - Fork 3
/
bump_version.py
32 lines (30 loc) · 1.26 KB
/
bump_version.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
def updateiOSVesions(version):
with open("ios/App/App.xcodeproj/project.pbxproj", "r", newline="") as file:
lines = file.readlines()
with open("ios/App/App.xcodeproj/project.pbxproj", "w", newline="") as file:
for line in lines:
if 'CURRENT_PROJECT_VERSION = ' in line:
line = ' CURRENT_PROJECT_VERSION = {};\n'.format(version)
if 'MARKETING_VERSION = ' in line:
line = ' MARKETING_VERSION = {};\n'.format(version)
file.write(line)
def updateAndroidVesions(version):
splittedPackage = list(map(int,version.split(".")))
buildnumber = splittedPackage[0] * 10000 + splittedPackage[1] * 100 + splittedPackage[2]
with open("android/app/build.gradle", "r", newline="") as file:
lines = file.readlines()
with open("android/app/build.gradle", "w", newline="") as file:
for line in lines:
if 'versionCode' in line:
line = ' versionCode {}\n'.format(buildnumber)
if 'versionName' in line:
line = ' versionName "{}"\n'.format(version)
file.write(line)
if __name__ == "__main__":
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("version")
parser.parse_args()
version = parser.parse_args().version
updateiOSVesions(version)
updateAndroidVesions(version)