decrypt_secrets.sh 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #!/usr/bin/env bash
  2. # Copyright 2025 Google LLC
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. # USAGE: ./decrypt_secrets.sh
  16. #
  17. # Decrypts the secret files used for integration tests with the
  18. # FirebaseAI sample app.
  19. #
  20. # Expects the environment variable "secrets_passphrase" to be set.
  21. # This should be set to gpg password for encrypting/decrypting the files.
  22. if [[ ! "${secrets_passphrase}" ]]; then
  23. echo "Missing environment variable (secrets_passphrase) to decrypt the files with."
  24. exit 1
  25. fi
  26. decrypt () {
  27. local source=$1
  28. local dest=$2
  29. scripts/decrypt_gha_secret.sh "$1" "$2" "${secrets_passphrase}"
  30. echo "${source} => ${dest}"
  31. }
  32. echo "Decrypting files"
  33. decrypt scripts/gha-encrypted/FirebaseAI/TestApp-GoogleService-Info.plist.gpg \
  34. FirebaseAI/Tests/TestApp/Resources/GoogleService-Info.plist
  35. decrypt scripts/gha-encrypted/FirebaseAI/TestApp-GoogleService-Info-Spark.plist.gpg \
  36. FirebaseAI/Tests/TestApp/Resources/GoogleService-Info-Spark.plist
  37. decrypt scripts/gha-encrypted/FirebaseAI/TestApp-Credentials.swift.gpg \
  38. FirebaseAI/Tests/TestApp/Tests/Integration/Credentials.swift
  39. echo "Files decrypted"