Skip to content

Commit a5fb4ed

Browse files
authored
Update script to check if 2 or 3 component semver (#128)
1 parent 4c6558c commit a5fb4ed

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

automation/update-from-application-services.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,19 @@ def __init__(self, app_services_version):
6767
data = json.loads(stream.read())
6868
app_services_version = data['version']
6969
components = app_services_version.split(".")
70-
if len(components) != 2:
70+
# check if the app services version is using the 2 or 3 component semver
71+
if len(components) == 2:
72+
# app_services_version is the 2-component version we normally use for application services
73+
self.app_services_version = app_services_version
74+
# swift_version is the 3-component version we use for Swift so that it's semver-compatible
75+
self.swift_version = f"{components[0]}.0.{components[1]}"
76+
# if it's 3-component, use as-is
77+
elif len(components) == 3:
78+
self.app_services_version = app_services_version
79+
self.swift_version = app_services_version
80+
else:
7181
raise ValueError(f"Invalid app_services_version: {app_services_version}")
7282

73-
74-
# app_services_version is the 2-component version we normally use for application services
75-
self.app_services_version = app_services_version
76-
# swift_version is the 3-component version we use for Swift so that it's semver-compatible
77-
self.swift_version = f"{components[0]}.0.{components[1]}"
78-
7983
def rev_exists(branch):
8084
result = subprocess.run(
8185
["git", "rev-parse", "--verify", branch],

0 commit comments

Comments
 (0)