Skip to content

Commit 120cda5

Browse files
committed
update-versions fixes for Firebase pod
1 parent 83853fa commit 120cda5

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

Releases/update-versions.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -161,26 +161,23 @@ def GenerateTag(pod, version):
161161
Returns:
162162
Tag.
163163
"""
164+
if pod == "Firebase":
165+
return version
164166
if pod.startswith("Firebase"):
165167
return '{}-{}'.format(pod[len('Firebase'):], version)
166168
if pod.startswith("Google"):
167169
return '{}-{}'.format(pod[len('Google'):], version)
168170
sys.exit("Script does not support generating a tag for {}".format(pod))
169171

170172

171-
def UpdateTags(version_data, firebase_version, first=False):
173+
def UpdateTags(version_data, first=False):
172174
"""Update tags.
173175
174176
Args:
175177
version_data: dictionary of versions to be updated.
176178
firebase_version: the Firebase version.
177179
first: set to true the first time the versions are set.
178180
"""
179-
if not first:
180-
LogOrRun("git push --delete origin '{}'".format(firebase_version))
181-
LogOrRun("git tag --delete '{}'".format(firebase_version))
182-
LogOrRun("git tag '{}'".format(firebase_version))
183-
LogOrRun("git push origin '{}'".format(firebase_version))
184181
for pod, version in version_data.items():
185182
tag = GenerateTag(pod, version)
186183
if not first:
@@ -190,7 +187,7 @@ def UpdateTags(version_data, firebase_version, first=False):
190187
LogOrRun("git push origin '{}'".format(tag))
191188

192189

193-
def CheckVersions(version_data):
190+
def CheckVersions(version_data, firebase_version):
194191
"""Ensure that versions do not already exist as tags.
195192
196193
Args:
@@ -199,6 +196,9 @@ def CheckVersions(version_data):
199196
error = False
200197
for pod, version in version_data.items():
201198
tag = GenerateTag(pod, version)
199+
if pod == "Firebase":
200+
if version != firebase_version:
201+
sys.exit("Aborting: Release version must match Firebase pod version.")
202202
find = subprocess.Popen(
203203
['git', 'tag', '-l', tag],
204204
stdout=subprocess.PIPE).communicate()[0].rstrip()
@@ -263,10 +263,10 @@ def UpdateVersions():
263263

264264
if not args.push_only:
265265
if args.tag_update:
266-
UpdateTags(version_data, args.version)
266+
UpdateTags(version_data)
267267
return
268268

269-
CheckVersions(version_data)
269+
CheckVersions(version_data, args.version)
270270
release_branch = 'release-{}'.format(args.version)
271271
CreateReleaseBranch(release_branch, args.base_branch)
272272
UpdatePodSpecs(git_root, version_data, args.version)
@@ -275,7 +275,7 @@ def UpdateVersions():
275275
LogOrRun('git commit -am "Update versions for Release {}"'
276276
.format(args.version))
277277
LogOrRun('git push origin {}'.format(release_branch))
278-
UpdateTags(version_data, args.version, True)
278+
UpdateTags(version_data, True)
279279

280280
PushPodspecs(version_data)
281281

0 commit comments

Comments
 (0)