diff --git a/.github/actions/generate-firebase-options/action.yaml b/.github/actions/generate-firebase-options/action.yaml new file mode 100644 index 0000000..fd439f1 --- /dev/null +++ b/.github/actions/generate-firebase-options/action.yaml @@ -0,0 +1,36 @@ +name: "Generate Firebase Options" +description: "Generate Firebase Options" +inputs: + firebase_service_account_json: + description: 'Firebase service account JSON' + required: true + firebase_project_id: + description: 'Firebase project ID' + required: true +runs: + using: "composite" + steps: + - uses: actions/checkout@v4 + + - name: Setup Firebase CLI + shell: bash + run: | + npm install -g firebase-tools + + - name: Configure Firebase Credentials + shell: bash + run: | + echo "${{ inputs.firebase_service_account_json }}" > service_account.json + + - name: Generate Options File + shell: bash + run: | + firebase use ${{ inputs.firebase_project_id }} --non-interactive + firebase apps:sdks --platform=android,ios,web > lib/firebase_options.dart + env: + GOOGLE_APPLICATION_CREDENTIALS: service_account.json + + - name: Clean up + shell: bash + if: always() + run: rm service_account.json \ No newline at end of file diff --git a/.github/workflows/default-workflow.yaml b/.github/workflows/default-workflow.yaml index 5a8435f..51390d7 100644 --- a/.github/workflows/default-workflow.yaml +++ b/.github/workflows/default-workflow.yaml @@ -15,6 +15,12 @@ jobs: - name: Prepare runner uses: ./.github/actions/prepare-ubuntu-runner + - name: Generate Firebase options + uses: ./.github/actions/generate-firebase-options + with: + firebase_service_account_json: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_JSON }} + firebase_project_id: ${{ secrets.FIREBASE_PROJECT_ID }} + - name: Run virtual machine tests run: bundle exec fastlane run_vm_tests @@ -28,6 +34,12 @@ jobs: - name: Prepare runner uses: ./.github/actions/prepare-ubuntu-runner + - name: Generate Firebase options + uses: ./.github/actions/generate-firebase-options + with: + firebase_service_account_json: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_JSON }} + firebase_project_id: ${{ secrets.FIREBASE_PROJECT_ID }} + - name: Build debug uses: ./.github/actions/build-android with: @@ -45,6 +57,12 @@ jobs: - name: Prepare runner uses: ./.github/actions/prepare-macos-runner + - name: Generate Firebase options + uses: ./.github/actions/generate-firebase-options + with: + firebase_service_account_json: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_JSON }} + firebase_project_id: ${{ secrets.FIREBASE_PROJECT_ID }} + - name: Decode and save .env file run: echo "${{ secrets.ENV_FILE }}" | base64 -d > .env diff --git a/.github/workflows/release-workflow.yaml b/.github/workflows/release-workflow.yaml index c098d2c..ad37bf3 100644 --- a/.github/workflows/release-workflow.yaml +++ b/.github/workflows/release-workflow.yaml @@ -15,6 +15,12 @@ jobs: - name: Prepare runner uses: ./.github/actions/prepare-ubuntu-runner + - name: Generate Firebase options + uses: ./.github/actions/generate-firebase-options + with: + firebase_service_account_json: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_JSON }} + firebase_project_id: ${{ secrets.FIREBASE_PROJECT_ID }} + - name: Run virtual machine tests run: bundle exec fastlane run_vm_tests @@ -28,6 +34,12 @@ jobs: - name: Prepare runner uses: ./.github/actions/prepare-ubuntu-runner + - name: Generate Firebase options + uses: ./.github/actions/generate-firebase-options + with: + firebase_service_account_json: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_JSON }} + firebase_project_id: ${{ secrets.FIREBASE_PROJECT_ID }} + - name: Decode and save key.properties run: echo "${{ secrets.ANDROID_KEY_PROPERTIES }}" | base64 -d > ./android/key.properties @@ -57,6 +69,12 @@ jobs: - name: Prepare runner uses: ./.github/actions/prepare-macos-runner + - name: Generate Firebase options + uses: ./.github/actions/generate-firebase-options + with: + firebase_service_account_json: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_JSON }} + firebase_project_id: ${{ secrets.FIREBASE_PROJECT_ID }} + - name: Decode and save .env file run: echo "${{ secrets.ENV_FILE }}" | base64 -d > .env