From 93969a18e39b4748ee426eba15aa7389bbf392ea Mon Sep 17 00:00:00 2001 From: Rebecca Franks Date: Fri, 11 Jul 2025 08:44:32 +0100 Subject: [PATCH] Add fake google-services.json and copy it to google-services.json when DEBUG_GOOGLE_SERVICES_JSON_BASE64 is empty. --- .github/workflows/build_and_test.yml | 16 +++++++++++++-- test-google-services.json | 29 ++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 test-google-services.json diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index cc5fd4a2..e7838e43 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -42,7 +42,13 @@ jobs: env: DEBUG_GOOGLE_SERVICES_JSON_BASE64: ${{ secrets.DEBUG_GOOGLE_SERVICES_JSON_BASE64 }} run: | - echo $DEBUG_GOOGLE_SERVICES_JSON_BASE64 | base64 --decode > app/google-services.json + if [ -z "$DEBUG_GOOGLE_SERVICES_JSON_BASE64" ]; then + echo "DEBUG_GOOGLE_SERVICES_JSON_BASE64 is empty. Copying test-google-services.json." + cp test-google-services.json app/google-services.json + else + echo "Decoding DEBUG_GOOGLE_SERVICES_JSON_BASE64." + echo $DEBUG_GOOGLE_SERVICES_JSON_BASE64 | base64 --decode > app/google-services.json + fi - name: Apply Spotless run: ./gradlew spotlessApply @@ -131,7 +137,13 @@ jobs: env: DEBUG_GOOGLE_SERVICES_JSON_BASE64: ${{ secrets.DEBUG_GOOGLE_SERVICES_JSON_BASE64 }} run: | - echo $DEBUG_GOOGLE_SERVICES_JSON_BASE64 | base64 --decode > app/google-services.json + if [ -z "$DEBUG_GOOGLE_SERVICES_JSON_BASE64" ]; then + echo "DEBUG_GOOGLE_SERVICES_JSON_BASE64 is empty. Copying test-google-services.json." + cp test-google-services.json app/google-services.json + else + echo "Decoding DEBUG_GOOGLE_SERVICES_JSON_BASE64." + echo $DEBUG_GOOGLE_SERVICES_JSON_BASE64 | base64 --decode > app/google-services.json + fi - name: Build run: ./gradlew assembleDebug assembleDebugAndroidTest diff --git a/test-google-services.json b/test-google-services.json new file mode 100644 index 00000000..323d195e --- /dev/null +++ b/test-google-services.json @@ -0,0 +1,29 @@ +{ + "project_info": { + "project_number": "abc", + "project_id": "YourProjectId", + "storage_bucket": "abc" + }, + "client": [ + { + "client_info": { + "mobilesdk_app_id": "APlaceholderAPIKeyWith-ThirtyNineCharsX", + "android_client_info": { + "package_name": "com.android.developers.androidify" + } + }, + "oauth_client": [], + "api_key": [ + { + "current_key": "APlaceholderAPIKeyWith-ThirtyNineCharsX" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [] + } + } + } + ], + "configuration_version": "1" +} \ No newline at end of file