From 644f2863f52c402854ba5be4d77c597127c370cf Mon Sep 17 00:00:00 2001 From: James Elgar Date: Fri, 15 Sep 2023 21:21:57 +0100 Subject: [PATCH] Fix app build --- .github/actions/setup-app/action.yml | 13 ++++++++++- .github/workflows/flutter-ci-cd.yaml | 24 +++++++++------------ .github/workflows/flutter-test.yml | 2 ++ .github/workflows/generate-podfile-lock.yml | 2 ++ 4 files changed, 26 insertions(+), 15 deletions(-) diff --git a/.github/actions/setup-app/action.yml b/.github/actions/setup-app/action.yml index e7e1f536..f9f8d01a 100644 --- a/.github/actions/setup-app/action.yml +++ b/.github/actions/setup-app/action.yml @@ -1,6 +1,11 @@ name: 'Setup app' description: 'Install flutter and dependencies' +inputs: + firebaseConfig: + description: 'Contents of google-services.json' + required: true + runs: using: "composite" steps: @@ -20,13 +25,19 @@ runs: channel: 'beta' # 'dev', 'alpha', default to: 'stable' flutter-version: '3.14.x' cache: true - + - name: Flutter version shell: bash run: | dart --version flutter --version + - name: Create firebase google-service.json + shell: bash + env: + FIREBASE_CONFIG: ${{ inputs.firebaseConfig }} + run: echo $FIREBASE_CONFIG > ./android/app/google-services.json + - name: Generate openapi client shell: bash run: cd openapi && make generate-prod diff --git a/.github/workflows/flutter-ci-cd.yaml b/.github/workflows/flutter-ci-cd.yaml index d3f5444c..1ae8528f 100644 --- a/.github/workflows/flutter-ci-cd.yaml +++ b/.github/workflows/flutter-ci-cd.yaml @@ -34,35 +34,29 @@ jobs: uses: timheuer/base64-to-file@v1 with: fileName: 'key.jks' + fileDir: './android/app/' encodedString: ${{ secrets.KEY_JKS_BASE64 }} - name: Key properties base64 to file id: write_file_key_properties - uses: timheuer/base64-to-file@v1 + uses: timheuer/base64-to-file@v1.2 with: fileName: 'key.properties' + fileDir: './android/' encodedString: ${{ secrets.KEY_PROPERTIES_BASE64 }} - - name: Move key.jks and key.properties to proper dir - run: | - mv ${{ steps.write_file_key.outputs.filePath }} ./android/app/ - mv ${{ steps.write_file_key_properties.outputs.filePath }} ./android/ - - - name: Create firebase google-service.json - env: - FIREBASE_CONFIG: ${{ secrets.FIREBASE_CONFIG_PROD }} - run: echo $FIREBASE_CONFIG > ./android/app/google-services.json - # Setup Java environment in order to build the Android app. - uses: actions/setup-java@v3 with: java-version: '17' distribution: 'temurin' cache: 'gradle' - + - name: Setup app uses: ./.github/actions/setup-app - + with: + firebaseConfig: ${{ secrets.FIREBASE_CONFIG_PROD }} + # env: # ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true' # env: @@ -77,7 +71,7 @@ jobs: # - run: echo $KEY_JKS > android/key.jks # Build apk - - run: flutter build appbundle --release + - run: flutter build appbundle --release -v # Upload generated apk to the artifacts. - uses: actions/upload-artifact@v1 @@ -141,6 +135,8 @@ jobs: - name: Setup app uses: ./.github/actions/setup-app + with: + firebaseConfig: ${{ secrets.FIREBASE_CONFIG_PROD }} # Build and sign the ipa using a single flutter command - name: Building IPA diff --git a/.github/workflows/flutter-test.yml b/.github/workflows/flutter-test.yml index d8ae16b2..5f2f743c 100644 --- a/.github/workflows/flutter-test.yml +++ b/.github/workflows/flutter-test.yml @@ -19,6 +19,8 @@ jobs: - name: Setup app uses: ./.github/actions/setup-app + with: + firebaseConfig: ${{ secrets.FIREBASE_CONFIG_PROD }} - run: pod repo update diff --git a/.github/workflows/generate-podfile-lock.yml b/.github/workflows/generate-podfile-lock.yml index 3e576566..dbddec46 100644 --- a/.github/workflows/generate-podfile-lock.yml +++ b/.github/workflows/generate-podfile-lock.yml @@ -14,6 +14,8 @@ jobs: # Checks-out our repository under $GITHUB_WORKSPACE, so our job can access it - name: Setup app uses: ./.github/actions/setup-app + with: + firebaseConfig: ${{ secrets.FIREBASE_CONFIG_PROD }} - run: cd ios && pod install --repo-update