release_testing_setup.sh 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. # Copyright 2020 Google LLC
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. set -xe
  15. TESTINGMODE=${1-}
  16. if [ -f "${HOME}/.cocoapods/repos" ]; then
  17. find "${HOME}/.cocoapods/repos" -type d -maxdepth 1 -exec sh -c 'pod repo remove $(basename {})' \;
  18. fi
  19. git config --global user.email "google-oss-bot@example.com"
  20. git config --global user.name "google-oss-bot"
  21. mkdir -p /tmp/test/firebase-ios-sdk
  22. echo "git clone ${podspec_repo_branch} from github.com/firebase/firebase-ios-sdk.git to ${local_sdk_repo_dir}"
  23. set +x
  24. git clone -q -b "${podspec_repo_branch}" https://"${BOT_TOKEN}"@github.com/firebase/firebase-ios-sdk.git "${local_sdk_repo_dir}"
  25. set -x
  26. if [ "$TESTINGMODE" = "nightly_testing" ]; then
  27. tag_version="nightly-test-${test_version}"
  28. echo "A new tag, ${tag_version},for nightly release testing will be created."
  29. fi
  30. if [ "$TESTINGMODE" = "RC_testing" ]; then
  31. tag_version="CocoaPods-${test_version}.nightly"
  32. echo "A new tag, ${tag_version},for prerelease testing will be created."
  33. fi
  34. # Update a tag.
  35. if [ -n "$tag_version" ]; then
  36. cd "${local_sdk_repo_dir}"
  37. set +e
  38. # If tag_version is new to the remote, remote cannot delete a non-existent
  39. # tag, so error is allowed here.
  40. git push origin --delete "${tag_version}"
  41. set -e
  42. git tag -f -a "${tag_version}" -m "release testing"
  43. git push origin "${tag_version}"
  44. # Update source and tag, e.g. ":tag => 'CocoaPods-' + s.version.to_s" to
  45. # ":tag => test"
  46. sed -i "" "s/\s*:tag.*/:tag => '${tag_version}'/" *.podspec
  47. fi
  48. cd "${GITHUB_WORKSPACE}/ZipBuilder"
  49. swift build
  50. # Update Pod versions.
  51. ./.build/debug/firebase-pod-updater --git-root "${local_sdk_repo_dir}" --releasing-pods "${GITHUB_WORKSPACE}/scripts/create_spec_repo/firebase_sdk.textproto"