-
Notifications
You must be signed in to change notification settings - Fork 0
/
get_next_build.py
39 lines (32 loc) · 1.08 KB
/
get_next_build.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
36
37
38
39
#!/usr/bin/python3
import sys
import getopt
from appstoreconnect_api import AppStoreConnectAPI
if __name__ == "__main__":
help_message = "get_next_build.py [bundle_id]"
prerelease_version = False
version = None
platform = "IOS"
if len(sys.argv) < 2:
print(help_message)
sys.exit(2)
bundle_id = sys.argv[1]
appstore_api = AppStoreConnectAPI()
try:
opts, args = getopt.getopt(sys.argv[2:], "", ["prerelease", "version=", "platform="])
except getopt.GetoptError:
print(help_message)
sys.exit(2)
for opt, arg in opts:
if opt in ("--prerelease"):
prerelease_version = True
if opt in ("--version="):
version = arg
if opt in ("--platform="):
platform = arg
if version:
next_build = appstore_api.get_next_build_for_version(bundle_id, version, prerelease=prerelease_version, platform=platform)
else:
next_build = appstore_api.get_next_build(bundle_id, prerelease=prerelease_version, platform=platform)
if next_build:
print(next_build)