2020-08-28 15:29:08 -07:00
|
|
|
# Copyright 2020 Google LLC
|
|
|
|
|
#
|
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
|
#
|
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
#
|
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
|
# limitations under the License.
|
|
|
|
|
|
2021-03-15 10:45:03 -07:00
|
|
|
# This script will `git clone` the SDK repo to local and look for the latest
|
|
|
|
|
# release branch
|
2020-09-14 10:08:13 -07:00
|
|
|
set -xe
|
2020-08-28 15:29:08 -07:00
|
|
|
|
2020-09-17 10:29:53 -07:00
|
|
|
TESTINGMODE=${1-}
|
|
|
|
|
|
2020-08-28 15:29:08 -07:00
|
|
|
if [ -f "${HOME}/.cocoapods/repos" ]; then
|
|
|
|
|
find "${HOME}/.cocoapods/repos" -type d -maxdepth 1 -exec sh -c 'pod repo remove $(basename {})' \;
|
|
|
|
|
fi
|
2020-09-24 14:28:05 -07:00
|
|
|
|
|
|
|
|
mkdir -p "${local_sdk_repo_dir}"
|
2020-09-17 10:29:53 -07:00
|
|
|
echo "git clone ${podspec_repo_branch} from github.com/firebase/firebase-ios-sdk.git to ${local_sdk_repo_dir}"
|
|
|
|
|
set +x
|
2021-03-15 10:45:03 -07:00
|
|
|
# Using token here to update tags later.
|
2020-09-24 14:28:05 -07:00
|
|
|
git clone -q https://"${BOT_TOKEN}"@github.com/firebase/firebase-ios-sdk.git "${local_sdk_repo_dir}"
|
2020-09-17 10:29:53 -07:00
|
|
|
set -x
|
2020-09-14 10:08:13 -07:00
|
|
|
|
2020-09-24 14:28:05 -07:00
|
|
|
cd "${local_sdk_repo_dir}"
|
2021-03-15 10:45:03 -07:00
|
|
|
# The chunk below is to determine the latest version by searching
|
2021-04-24 02:19:05 -07:00
|
|
|
# Get the latest origin/release-X.Y.Z branch in the remote repo for release branch testing.
|
|
|
|
|
release_branch=$(git branch -l -r --sort=-version:refname origin/release-* | head -n 1 )
|
|
|
|
|
# Get the latest released tag Cocoapods-X.Y.Z for prerelease testing, beta version will be excluded.
|
|
|
|
|
test_version=$(git tag -l --sort=-version:refname CocoaPods-*[0-9] | head -n 1)
|
2020-09-24 14:28:05 -07:00
|
|
|
|
2021-03-15 10:45:03 -07:00
|
|
|
if [ -z $podspec_repo_branch ];then
|
2021-04-07 17:59:00 -07:00
|
|
|
# Get release branch, origin/release-X.Y.Z.
|
2021-04-08 13:18:48 -07:00
|
|
|
podspec_repo_branch=$(echo $release_branch | sed -n 's/\s*//p')
|
2021-03-15 10:45:03 -07:00
|
|
|
fi
|
2020-09-24 14:28:05 -07:00
|
|
|
|
|
|
|
|
git config --global user.email "google-oss-bot@example.com"
|
|
|
|
|
git config --global user.name "google-oss-bot"
|
2021-04-07 17:59:00 -07:00
|
|
|
git checkout "${podspec_repo_branch}"
|
2021-03-24 09:56:41 -07:00
|
|
|
if [ "$TESTINGMODE" = "release_testing" ]; then
|
2021-04-26 08:50:25 -07:00
|
|
|
# Latest release branch with prefix CocoaPods, e.g. CocoaPods-7.11
|
|
|
|
|
latest_branch_version=$(git branch -l -r --sort=-v:refname origin/release-* | head -n 1 | sed -n 's/^[ \t]*origin\/release/CocoaPods/p' )
|
|
|
|
|
# Latest tag of release branch on the repo, e.g. Cocoapods-7.9.0
|
|
|
|
|
latest_release_branch_tag=$(git tag -l --sort=-version:refname "$latest_branch_version"*[0-9] | head -n 1)
|
2021-04-24 02:19:05 -07:00
|
|
|
echo "Podspecs tags of Nightly release testing will be updated to ${latest_release_branch_tag}."
|
2021-03-24 09:56:41 -07:00
|
|
|
# Update source and tag, e.g. ":tag => 'CocoaPods-' + s.version.to_s" to
|
|
|
|
|
# ":tag => 'CocoaPods-7.9.0'"
|
2021-04-24 02:19:05 -07:00
|
|
|
sed -i "" "s/\s*:tag.*/:tag => '${latest_release_branch_tag}'/" *.podspec
|
2021-03-24 09:56:41 -07:00
|
|
|
elif [ "$TESTINGMODE" = "prerelease_testing" ]; then
|
2021-04-24 02:19:05 -07:00
|
|
|
tag_version="${test_version}.nightly"
|
2020-09-17 10:29:53 -07:00
|
|
|
echo "A new tag, ${tag_version},for prerelease testing will be created."
|
|
|
|
|
set +e
|
|
|
|
|
# If tag_version is new to the remote, remote cannot delete a non-existent
|
|
|
|
|
# tag, so error is allowed here.
|
|
|
|
|
git push origin --delete "${tag_version}"
|
|
|
|
|
set -e
|
|
|
|
|
git tag -f -a "${tag_version}" -m "release testing"
|
|
|
|
|
git push origin "${tag_version}"
|
|
|
|
|
# Update source and tag, e.g. ":tag => 'CocoaPods-' + s.version.to_s" to
|
2021-04-24 02:19:05 -07:00
|
|
|
# ":tag => ${test_version}.nightly"
|
2020-09-17 10:29:53 -07:00
|
|
|
sed -i "" "s/\s*:tag.*/:tag => '${tag_version}'/" *.podspec
|
|
|
|
|
fi
|