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.
|
|
|
|
|
|
2024-08-02 17:13:22 -04:00
|
|
|
# Note: This script uses the currently checked out repo.
|
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
|
|
|
|
2024-08-02 17:13:22 -04:00
|
|
|
git fetch --tags --quiet origin main
|
|
|
|
|
git checkout main
|
2020-09-14 10:08:13 -07:00
|
|
|
|
2021-03-15 10:45:03 -07:00
|
|
|
# The chunk below is to determine the latest version by searching
|
2024-10-02 11:40:12 -04:00
|
|
|
# Get the latest released tag Cocoapods-X.Y.Z for release and prerelease
|
|
|
|
|
# testing, beta version will be excluded.
|
|
|
|
|
# Note: If the nightly tag was not updated, check that the next release's tag
|
|
|
|
|
# is on the main branch.
|
2024-07-31 19:13:51 -04:00
|
|
|
test_version=$(git tag -l --sort=-version:refname --merged main 'CocoaPods-*[0-9]' | head -n 1)
|
2024-07-31 18:50:23 -04:00
|
|
|
if [ -z "$test_version" ]; then
|
|
|
|
|
echo "Latest tag could not be found. Exiting." >&2
|
|
|
|
|
exit 1
|
|
|
|
|
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}"
|
2022-05-26 12:32:13 -07:00
|
|
|
# Ensure the tag version including pod version to avoid warnings.
|
|
|
|
|
# https://github.com/CocoaPods/Core/blob/e6451e172c33f3aa77a3f8baa7b6b5b8c3b5da14/lib/cocoapods-core/specification/linter.rb#L372-L374
|
|
|
|
|
pod_testing_version=`echo "${test_version}" | sed "s/CocoaPods-//"`
|
2021-03-24 09:56:41 -07:00
|
|
|
if [ "$TESTINGMODE" = "release_testing" ]; then
|
2022-01-19 11:39:00 -08:00
|
|
|
git checkout "${test_version}"
|
|
|
|
|
echo "Podspecs tags of Nightly release testing will be updated to ${test_version}."
|
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'"
|
2022-05-26 12:32:13 -07:00
|
|
|
sed -i "" "s/\s*:tag.*/:tag => '${test_version}'/" *.podspec
|
|
|
|
|
sed -i "" "s/s\.version[[:space:]]*=.*/s\.version='${pod_testing_version}'/" *.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"
|
2024-07-01 18:08:08 -04:00
|
|
|
echo "A new tag, ${tag_version}, for prerelease testing will be created."
|
2020-09-17 10:29:53 -07:00
|
|
|
set +e
|
|
|
|
|
# If tag_version is new to the remote, remote cannot delete a non-existent
|
|
|
|
|
# tag, so error is allowed here.
|
2024-07-01 18:08:08 -04:00
|
|
|
git push origin --delete "${tag_version}" > /dev/null 2>&1
|
2020-09-17 10:29:53 -07:00
|
|
|
set -e
|
|
|
|
|
git tag -f -a "${tag_version}" -m "release testing"
|
2026-01-21 11:55:17 -05:00
|
|
|
git push origin "${tag_version}" || {
|
|
|
|
|
echo "ERROR: Failed to push tag ${tag_version}. This is likely due to an expired Personal Access Token (PAT) or insufficient permissions." >&2
|
|
|
|
|
exit 1
|
|
|
|
|
}
|
2020-09-17 10:29:53 -07:00
|
|
|
# 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"
|
2022-05-26 12:32:13 -07:00
|
|
|
sed -i "" "s/\s*:tag.*/:tag => '${tag_version}'/" *.podspec
|
|
|
|
|
sed -i "" "s/s\.version[[:space:]]*=.*/s\.version='${pod_testing_version}'/" *.podspec
|
2020-09-17 10:29:53 -07:00
|
|
|
fi
|