@@ -19,14 +19,28 @@ TESTINGMODE=${1-}
1919if [ -f " ${HOME} /.cocoapods/repos" ]; then
2020 find " ${HOME} /.cocoapods/repos" -type d -maxdepth 1 -exec sh -c ' pod repo remove $(basename {})' \;
2121fi
22- git config --global user.email " google-oss-bot@example.com"
23- git config --global user.name " google-oss-bot"
24- mkdir -p /tmp/test/firebase-ios-sdk
22+
23+ mkdir -p " ${local_sdk_repo_dir} "
2524echo " git clone ${podspec_repo_branch} from github.com/firebase/firebase-ios-sdk.git to ${local_sdk_repo_dir} "
2625set +x
27- git clone -q -b " ${podspec_repo_branch} " https://" ${BOT_TOKEN} " @github.com/firebase/firebase-ios-sdk.git " ${local_sdk_repo_dir} "
26+ git clone -q https://" ${BOT_TOKEN} " @github.com/firebase/firebase-ios-sdk.git " ${local_sdk_repo_dir} "
2827set -x
2928
29+ cd " ${local_sdk_repo_dir} "
30+ # This is to search Cocoapods-X.Y.Z tags from all branches of the sdk repo and test_version is X.Y.Z
31+ test_version=$( git tag -l --sort=-version:refname CocoaPods-* [0-9] | head -n 1 | sed -n ' s/CocoaPods-//p' )
32+ # Check if release-X.Y.Z branch exists in the remote repo.
33+ release_branch=$( git branch -r -l " origin/release-${test_version} " )
34+ if [ -z $release_branch ]; then
35+ echo " release-${test_version} branch does not exist in the sdk repo."
36+ exit 1
37+ fi
38+
39+ # Get release branch, release-X.Y.Z.
40+ podspec_repo_branch=$( echo $release_branch | sed -n ' s/\s*origin\///p' )
41+
42+ git config --global user.email " google-oss-bot@example.com"
43+ git config --global user.name " google-oss-bot"
3044if [ " $TESTINGMODE " = " nightly_testing" ]; then
3145 tag_version=" nightly-test-${test_version} "
3246 echo " A new tag, ${tag_version} ,for nightly release testing will be created."
@@ -37,7 +51,7 @@ if [ "$TESTINGMODE" = "RC_testing" ]; then
3751fi
3852# Update a tag.
3953if [ -n " $tag_version " ]; then
40- cd " ${local_sdk_repo_dir } "
54+ git checkout " ${podspec_repo_branch } "
4155 set +e
4256 # If tag_version is new to the remote, remote cannot delete a non-existent
4357 # tag, so error is allowed here.
0 commit comments