upload_to_gcs.sh 1.3 KB

123456789101112131415161718192021222324252627282930
  1. #!/bin/bash
  2. # Copyright 2020 Google
  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. # http://www.apache.org/licenses/LICENSE-2.0
  7. # Unless required by applicable law or agreed to in writing, software
  8. # distributed under the License is distributed on an "AS IS" BASIS,
  9. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. # See the License for the specific language governing permissions and
  11. # limitations under the License.
  12. set -x
  13. GITHUB_HASH="$1"
  14. FRAMEWORK_DIR="$2"
  15. if [ "${GITHUB_HASH}"=="Fail" ]
  16. then
  17. echo "Zip build or gcloud setup might be failed."
  18. echo "The last zip workflow failed." > latest_commit_hash.txt
  19. gsutil cp latest_commit_hash.txt "gs://ios-framework-zip/latest_commit_hash.txt"
  20. else
  21. echo "Commit Hash: ${GITHUB_HASH}"
  22. zip -r Firebase-actions-dir.zip "${FRAMEWORK_DIR}"
  23. gsutil cp Firebase-actions-dir.zip "gs://ios-framework-zip/Firebase-actions-dir-${GITHUB_HASH}.zip"
  24. # Keep the commit hash, and so SDK testing can load latest zip based on the commit hash.
  25. touch latest_commit_hash.txt
  26. echo "${GITHUB_HASH}" > latest_commit_hash.txt
  27. gsutil cp latest_commit_hash.txt "gs://ios-framework-zip/latest_commit_hash.txt"
  28. fi