From 05bee06b3ceefa87621c2f34335f4a8f95878f81 Mon Sep 17 00:00:00 2001 From: nriedman <108841122+nriedman@users.noreply.github.com> Date: Tue, 3 Sep 2024 11:08:06 -0700 Subject: [PATCH 1/8] Add input for custom command in firebase emulators:exec --- .github/workflows/xcodebuild-or-fastlane.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/xcodebuild-or-fastlane.yml b/.github/workflows/xcodebuild-or-fastlane.yml index 64664be..973b70c 100644 --- a/.github/workflows/xcodebuild-or-fastlane.yml +++ b/.github/workflows/xcodebuild-or-fastlane.yml @@ -122,6 +122,13 @@ on: required: false type: boolean default: false + customfirebaseemulatorcommand: + description: | + A custom command that should be run right before executing the fastlane command. + Only used if `setupfirebaseemulator` is set to true, 'fastlanelane' is set, and no `firebaseemulatorimport` is set. + required: false + type: string + default: '' firebaseemulatorimport: description: | Firebase import directory that contains Authentication, Cloud Firestore, Realtime Database and Cloud Storage data for Firebase emulators. @@ -376,7 +383,10 @@ jobs: echo "Importing firebase emulator data from ${{ inputs.firebaseemulatorimport }}" firebase emulators:exec --import=${{ inputs.firebaseemulatorimport }} 'fastlane ${{ inputs.fastlanelane }}' else - firebase emulators:exec 'fastlane ${{ inputs.fastlanelane }}' + if [ -n "${{ inputs.customfirebaseemulatorcommand }}" ]; then + firebase emulators:exec '${{ inputs.customfirebaseemulatorcommand }} && fastlane ${{ inputs.fastlanelane }}' + else + firebase emulators:exec 'fastlane ${{ inputs.fastlanelane }}' fi else fastlane ${{ inputs.fastlanelane }} From 59f548ae7164985edc6a17531a3ef9c307d1b3e5 Mon Sep 17 00:00:00 2001 From: nriedman <108841122+nriedman@users.noreply.github.com> Date: Tue, 3 Sep 2024 13:43:55 -0700 Subject: [PATCH 2/8] Fix syntax error --- .github/workflows/xcodebuild-or-fastlane.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/xcodebuild-or-fastlane.yml b/.github/workflows/xcodebuild-or-fastlane.yml index 973b70c..79799db 100644 --- a/.github/workflows/xcodebuild-or-fastlane.yml +++ b/.github/workflows/xcodebuild-or-fastlane.yml @@ -387,6 +387,7 @@ jobs: firebase emulators:exec '${{ inputs.customfirebaseemulatorcommand }} && fastlane ${{ inputs.fastlanelane }}' else firebase emulators:exec 'fastlane ${{ inputs.fastlanelane }}' + fi fi else fastlane ${{ inputs.fastlanelane }} From fe308507c4177d63c69bc4a846be6b402bf9c484 Mon Sep 17 00:00:00 2001 From: nriedman <108841122+nriedman@users.noreply.github.com> Date: Tue, 3 Sep 2024 14:41:44 -0700 Subject: [PATCH 3/8] Include custom firebase json path option --- .github/workflows/xcodebuild-or-fastlane.yml | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/.github/workflows/xcodebuild-or-fastlane.yml b/.github/workflows/xcodebuild-or-fastlane.yml index 79799db..536c634 100644 --- a/.github/workflows/xcodebuild-or-fastlane.yml +++ b/.github/workflows/xcodebuild-or-fastlane.yml @@ -122,6 +122,13 @@ on: required: false type: boolean default: false + firebasejsonpath: + description: | + Path to the firebase.json file that is used to configure the Firebase Emulator. + Defaults to './firebase.json' in the root directory. + required: false + type: string + default: '' customfirebaseemulatorcommand: description: | A custom command that should be run right before executing the fastlane command. @@ -379,14 +386,21 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="$RUNNER_TEMP/google-application-credentials.json" echo "Stored the Google application credentials at $GOOGLE_APPLICATION_CREDENTIALS" + # Use the custom path to the firebase.json file if provided. + if [ -n "${{ inputs.firebasejsonpath }}" ]; then + firebaseJSONPath = ${{ inputs.firebasejsonpath }} + else + firebaseJSONPath = "./firebase.json" + fi + if [ -n "${{ inputs.firebaseemulatorimport }}" ]; then echo "Importing firebase emulator data from ${{ inputs.firebaseemulatorimport }}" - firebase emulators:exec --import=${{ inputs.firebaseemulatorimport }} 'fastlane ${{ inputs.fastlanelane }}' + firebase emulators:exec -c firebaseJSONPath --import=${{ inputs.firebaseemulatorimport }} 'fastlane ${{ inputs.fastlanelane }}' else if [ -n "${{ inputs.customfirebaseemulatorcommand }}" ]; then - firebase emulators:exec '${{ inputs.customfirebaseemulatorcommand }} && fastlane ${{ inputs.fastlanelane }}' + firebase emulators:exec -c firebaseJSONPath '${{ inputs.customfirebaseemulatorcommand }} && fastlane ${{ inputs.fastlanelane }}' else - firebase emulators:exec 'fastlane ${{ inputs.fastlanelane }}' + firebase emulators:exec -c firebaseJSONPath 'fastlane ${{ inputs.fastlanelane }}' fi fi else From 0f4dcabcdabbd9a491f93e8382fdb50933fb9d2f Mon Sep 17 00:00:00 2001 From: nriedman <108841122+nriedman@users.noreply.github.com> Date: Tue, 3 Sep 2024 14:57:18 -0700 Subject: [PATCH 4/8] fix firebase json path not found --- .github/workflows/xcodebuild-or-fastlane.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/xcodebuild-or-fastlane.yml b/.github/workflows/xcodebuild-or-fastlane.yml index 536c634..44bb2d7 100644 --- a/.github/workflows/xcodebuild-or-fastlane.yml +++ b/.github/workflows/xcodebuild-or-fastlane.yml @@ -388,19 +388,19 @@ jobs: # Use the custom path to the firebase.json file if provided. if [ -n "${{ inputs.firebasejsonpath }}" ]; then - firebaseJSONPath = ${{ inputs.firebasejsonpath }} + export FIREBASE_JSON_PATH="${{ inputs.firebasejsonpath }}" else - firebaseJSONPath = "./firebase.json" + export FIREBASE_JSON_PATH="./firebase.json" fi if [ -n "${{ inputs.firebaseemulatorimport }}" ]; then echo "Importing firebase emulator data from ${{ inputs.firebaseemulatorimport }}" - firebase emulators:exec -c firebaseJSONPath --import=${{ inputs.firebaseemulatorimport }} 'fastlane ${{ inputs.fastlanelane }}' + firebase emulators:exec -c FIREBASE_JSON_PATH --import=${{ inputs.firebaseemulatorimport }} 'fastlane ${{ inputs.fastlanelane }}' else if [ -n "${{ inputs.customfirebaseemulatorcommand }}" ]; then - firebase emulators:exec -c firebaseJSONPath '${{ inputs.customfirebaseemulatorcommand }} && fastlane ${{ inputs.fastlanelane }}' + firebase emulators:exec -c FIREBASE_JSON_PATH '${{ inputs.customfirebaseemulatorcommand }} && fastlane ${{ inputs.fastlanelane }}' else - firebase emulators:exec -c firebaseJSONPath 'fastlane ${{ inputs.fastlanelane }}' + firebase emulators:exec -c FIREBASE_JSON_PATH 'fastlane ${{ inputs.fastlanelane }}' fi fi else From 36edd58fb577d7143b7431a74c7cdbe8a1009d73 Mon Sep 17 00:00:00 2001 From: nriedman <108841122+nriedman@users.noreply.github.com> Date: Tue, 3 Sep 2024 15:00:14 -0700 Subject: [PATCH 5/8] Update xcodebuild-or-fastlane.yml --- .github/workflows/xcodebuild-or-fastlane.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/xcodebuild-or-fastlane.yml b/.github/workflows/xcodebuild-or-fastlane.yml index 44bb2d7..5ba085c 100644 --- a/.github/workflows/xcodebuild-or-fastlane.yml +++ b/.github/workflows/xcodebuild-or-fastlane.yml @@ -407,6 +407,7 @@ jobs: fastlane ${{ inputs.fastlanelane }} fi env: + FIREBASE_JSON_PATH: "./firebase.json" APP_STORE_CONNECT_API_KEY_ID: ${{ secrets.APP_STORE_CONNECT_API_KEY_ID }} APP_STORE_CONNECT_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_ISSUER_ID }} APP_STORE_CONNECT_API_KEY_BASE64: ${{ secrets.APP_STORE_CONNECT_API_KEY_BASE64 }} From ab1b4362a62afccb6fd747dc9d9b728526de6a57 Mon Sep 17 00:00:00 2001 From: nriedman <108841122+nriedman@users.noreply.github.com> Date: Tue, 3 Sep 2024 15:04:28 -0700 Subject: [PATCH 6/8] Fix not dereferencing environment variable --- .github/workflows/xcodebuild-or-fastlane.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/xcodebuild-or-fastlane.yml b/.github/workflows/xcodebuild-or-fastlane.yml index 5ba085c..3a126d1 100644 --- a/.github/workflows/xcodebuild-or-fastlane.yml +++ b/.github/workflows/xcodebuild-or-fastlane.yml @@ -395,19 +395,18 @@ jobs: if [ -n "${{ inputs.firebaseemulatorimport }}" ]; then echo "Importing firebase emulator data from ${{ inputs.firebaseemulatorimport }}" - firebase emulators:exec -c FIREBASE_JSON_PATH --import=${{ inputs.firebaseemulatorimport }} 'fastlane ${{ inputs.fastlanelane }}' + firebase emulators:exec -c $FIREBASE_JSON_PATH --import=${{ inputs.firebaseemulatorimport }} 'fastlane ${{ inputs.fastlanelane }}' else if [ -n "${{ inputs.customfirebaseemulatorcommand }}" ]; then - firebase emulators:exec -c FIREBASE_JSON_PATH '${{ inputs.customfirebaseemulatorcommand }} && fastlane ${{ inputs.fastlanelane }}' + firebase emulators:exec -c $FIREBASE_JSON_PATH '${{ inputs.customfirebaseemulatorcommand }} && fastlane ${{ inputs.fastlanelane }}' else - firebase emulators:exec -c FIREBASE_JSON_PATH 'fastlane ${{ inputs.fastlanelane }}' + firebase emulators:exec -c $FIREBASE_JSON_PATH 'fastlane ${{ inputs.fastlanelane }}' fi fi else fastlane ${{ inputs.fastlanelane }} fi env: - FIREBASE_JSON_PATH: "./firebase.json" APP_STORE_CONNECT_API_KEY_ID: ${{ secrets.APP_STORE_CONNECT_API_KEY_ID }} APP_STORE_CONNECT_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_ISSUER_ID }} APP_STORE_CONNECT_API_KEY_BASE64: ${{ secrets.APP_STORE_CONNECT_API_KEY_BASE64 }} From f09b89799bb6545cf0066bd209c78a21e78d97bc Mon Sep 17 00:00:00 2001 From: nriedman <108841122+nriedman@users.noreply.github.com> Date: Wed, 4 Sep 2024 09:22:23 -0700 Subject: [PATCH 7/8] Undo all changes --- .github/workflows/xcodebuild-or-fastlane.yml | 29 ++------------------ 1 file changed, 2 insertions(+), 27 deletions(-) diff --git a/.github/workflows/xcodebuild-or-fastlane.yml b/.github/workflows/xcodebuild-or-fastlane.yml index 3a126d1..64664be 100644 --- a/.github/workflows/xcodebuild-or-fastlane.yml +++ b/.github/workflows/xcodebuild-or-fastlane.yml @@ -122,20 +122,6 @@ on: required: false type: boolean default: false - firebasejsonpath: - description: | - Path to the firebase.json file that is used to configure the Firebase Emulator. - Defaults to './firebase.json' in the root directory. - required: false - type: string - default: '' - customfirebaseemulatorcommand: - description: | - A custom command that should be run right before executing the fastlane command. - Only used if `setupfirebaseemulator` is set to true, 'fastlanelane' is set, and no `firebaseemulatorimport` is set. - required: false - type: string - default: '' firebaseemulatorimport: description: | Firebase import directory that contains Authentication, Cloud Firestore, Realtime Database and Cloud Storage data for Firebase emulators. @@ -386,22 +372,11 @@ jobs: export GOOGLE_APPLICATION_CREDENTIALS="$RUNNER_TEMP/google-application-credentials.json" echo "Stored the Google application credentials at $GOOGLE_APPLICATION_CREDENTIALS" - # Use the custom path to the firebase.json file if provided. - if [ -n "${{ inputs.firebasejsonpath }}" ]; then - export FIREBASE_JSON_PATH="${{ inputs.firebasejsonpath }}" - else - export FIREBASE_JSON_PATH="./firebase.json" - fi - if [ -n "${{ inputs.firebaseemulatorimport }}" ]; then echo "Importing firebase emulator data from ${{ inputs.firebaseemulatorimport }}" - firebase emulators:exec -c $FIREBASE_JSON_PATH --import=${{ inputs.firebaseemulatorimport }} 'fastlane ${{ inputs.fastlanelane }}' + firebase emulators:exec --import=${{ inputs.firebaseemulatorimport }} 'fastlane ${{ inputs.fastlanelane }}' else - if [ -n "${{ inputs.customfirebaseemulatorcommand }}" ]; then - firebase emulators:exec -c $FIREBASE_JSON_PATH '${{ inputs.customfirebaseemulatorcommand }} && fastlane ${{ inputs.fastlanelane }}' - else - firebase emulators:exec -c $FIREBASE_JSON_PATH 'fastlane ${{ inputs.fastlanelane }}' - fi + firebase emulators:exec 'fastlane ${{ inputs.fastlanelane }}' fi else fastlane ${{ inputs.fastlanelane }} From b436f077562eaf584b3012dc5502d3c0183a061c Mon Sep 17 00:00:00 2001 From: nriedman <108841122+nriedman@users.noreply.github.com> Date: Thu, 5 Sep 2024 13:05:40 -0700 Subject: [PATCH 8/8] Add firebase json path as an input --- .github/workflows/xcodebuild-or-fastlane.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/xcodebuild-or-fastlane.yml b/.github/workflows/xcodebuild-or-fastlane.yml index 64664be..1546f35 100644 --- a/.github/workflows/xcodebuild-or-fastlane.yml +++ b/.github/workflows/xcodebuild-or-fastlane.yml @@ -129,6 +129,13 @@ on: required: false type: string default: '' + firebasejsonpath: + description: | + Path to the firebase.json file that is used to boot up the firebase emulator. + Defaults to the root of the project. + required: false + type: string + default: './firebase.json' googleserviceinfoplistpath: description: | Path to the GoogleService-Info.plist file that is replaced using the content found in the secret GOOGLE_SERVICE_INFO_PLIST. @@ -374,9 +381,9 @@ jobs: if [ -n "${{ inputs.firebaseemulatorimport }}" ]; then echo "Importing firebase emulator data from ${{ inputs.firebaseemulatorimport }}" - firebase emulators:exec --import=${{ inputs.firebaseemulatorimport }} 'fastlane ${{ inputs.fastlanelane }}' + firebase emulators:exec -c ${{ inputs.firebasejsonpath }} --import=${{ inputs.firebaseemulatorimport }} 'fastlane ${{ inputs.fastlanelane }}' else - firebase emulators:exec 'fastlane ${{ inputs.fastlanelane }}' + firebase emulators:exec -c ${{ inputs.firebasejsonpath }} 'fastlane ${{ inputs.fastlanelane }}' fi else fastlane ${{ inputs.fastlanelane }}