From 9a3fd922fe40f0fcfeeb81f25256bbf97ad4e30b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uraz=20Akg=C3=BCltan?= Date: Thu, 23 May 2024 11:59:54 +0200 Subject: [PATCH] update github action --- .github/actions/build_android/action.yml | 25 +++++++++++++++-- .github/workflows/BuildAndroid.yml | 32 ++++++++++++++++++++++ .github/workflows/test.yml | 3 +++ android/app/google-services.json | 34 ++++++++++++++++++------ android/fastlane/Fastfile | 12 +++------ 5 files changed, 88 insertions(+), 18 deletions(-) create mode 100644 .github/workflows/BuildAndroid.yml diff --git a/.github/actions/build_android/action.yml b/.github/actions/build_android/action.yml index 6571884..b1963bf 100644 --- a/.github/actions/build_android/action.yml +++ b/.github/actions/build_android/action.yml @@ -1,5 +1,16 @@ name: 'Build Android App' description: 'Builds the Android app using Fastlane' +inputs: + firebaseAPIKey: + required: true + keystorePath: + required: true + keystoreAlias: + required: true + keystorePassword: + required: true + keystoreKeyPassword: + required: true runs: using: 'composite' @@ -26,11 +37,21 @@ runs: node-version-file: .nvmrc - name: Build Android Library with Fastlane - run: cd android && fastlane android local + run: | + cd android + fastlane android local shell: bash + env: + FIREBASE_API_KEY: ${{ inputs.firebaseAPIKey }} + ANDROID_KEYSTORE_PATH: ${{ inputs.keystorePath }} + ANDROID_KEYSTORE_PASSWORD: ${{ inputs.keystorePassword }} + ANDROID_KEYSTORE_ALIAS: ${{ inputs.keystoreAlias }} + ANDROID_KEYSTORE_KEY_PASSWORD: ${{ inputs.keystoreKeyPassword }} - name: Copy Android Library to Shared Directory - run: mkdir -p ${{ github.workspace }}/artifacts/android && cp ./artifacts/app-production-debug.apk ${{ github.workspace }}/artifacts/android/app-production-debug.apk + run: | + mkdir -p ${{ github.workspace }}/artifacts/android + cp ./artifacts/app-production-debug.apk ${{ github.workspace }}/artifacts/android/app-production-debug.apk shell: bash - name: Upload apk to artifact diff --git a/.github/workflows/BuildAndroid.yml b/.github/workflows/BuildAndroid.yml new file mode 100644 index 0000000..d4822fb --- /dev/null +++ b/.github/workflows/BuildAndroid.yml @@ -0,0 +1,32 @@ +name: "Build Android" + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Retrieve the secrets and decode it to a file + run: | + echo $UPLOAD_KEYSTORE_BASE64 | base64 --decode > ./android/keystores/upload.keystore + echo $PLAY_STORE_CREDENTIALS_BASE64 | base64 --decode > ./android/fastlane/play-store-credentials.json + shell: bash + + - name: Build Android apk + uses: ./.github/actions/build_android + with: + firebaseAPIKey: ${{ secrets.FIREBASE_API_KEY }} + keystorePath: ${{ env.ANDROID_KEYSTORE_PATH }} + keystoreAlias: ${{ secrets.ANDROID_KEYSTORE_ALIAS }} + keystorePassword: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }} + keystoreKeyPassword: ${{ secrets.ANDROID_KEYSTORE_KEY_PASSWORD }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 524e5ad..9e2cff7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,3 +18,6 @@ jobs: - name: Build Android apk uses: ./.github/actions/build_android + env: + UPLOAD_KEYSTORE_BASE64: ${{ secrets.UPLOAD_KEYSTORE_BASE64 }} + PLAY_STORE_CREDENTIALS_BASE64: ${{ secrets.PLAY_STORE_CREDENTIALS_BASE64 }} diff --git a/android/app/google-services.json b/android/app/google-services.json index 9d4bfcb..1fd8b6c 100644 --- a/android/app/google-services.json +++ b/android/app/google-services.json @@ -1,29 +1,47 @@ { "project_info": { - "project_number": "788164346630", - "project_id": "make-it-native-test", - "storage_bucket": "make-it-native-test.appspot.com" + "project_number": "542084943474", + "firebase_url": "https://mendix-developerapp.firebaseio.com", + "project_id": "mendix-developerapp", + "storage_bucket": "mendix-developerapp.appspot.com" }, "client": [ { "client_info": { - "mobilesdk_app_id": "1:788164346630:android:8abda4292fe590982d1487", + "mobilesdk_app_id": "1:542084943474:android:2ca19794e96659b1da7ceb", "android_client_info": { "package_name": "com.mendix.developerapp.mx10" } }, - "oauth_client": [], + "oauth_client": [ + { + "client_id": "542084943474-kuqtb0msdmjroc74mf9t9oui5if4046i.apps.googleusercontent.com", + "client_type": 3 + } + ], "api_key": [ { - "current_key": "AIzaSyD3pLyuEY38P44jR1hHYr00qKwOL_kJm_k" + "current_key": "{{firebase-api-key}}" } ], "services": { "appinvite_service": { - "other_platform_oauth_client": [] + "other_platform_oauth_client": [ + { + "client_id": "542084943474-kuqtb0msdmjroc74mf9t9oui5if4046i.apps.googleusercontent.com", + "client_type": 3 + }, + { + "client_id": "542084943474-03rk9m3agr20fs8fnjg4if2kosog0iil.apps.googleusercontent.com", + "client_type": 2, + "ios_info": { + "bundle_id": "com.mendix.developerapp.native.mx10" + } + } + ] } } } ], "configuration_version": "1" -} \ No newline at end of file +} diff --git a/android/fastlane/Fastfile b/android/fastlane/Fastfile index 642bcef..acb85ff 100644 --- a/android/fastlane/Fastfile +++ b/android/fastlane/Fastfile @@ -6,11 +6,9 @@ default_platform(:android) -ENV["GRADLE_BINTRAY_REPO"] = ENV["NEXUS_BINTRAY_PROXY_URL"] -ENV["GRADLE_JITPACK_REPO"] = ENV["NEXUS_JITPACK_PROXY_URL"] - GOOGLE_PLAY_VERSION = sh("node -p -e \"require('../../package.json')['store-versions']['google-play']\"").chomp BUILD_NUMBER = ENV["BUILD_NUMBER"] +TEST = ENV["TEST"] ORIGINAL_CHANGELOG_PATH = "../../CHANGELOG.android.txt" FASTLANE_CHANGELOG_PATH = "./metadata/android/en-US/changelogs/default.txt" versionCodeOffset = 304 @@ -18,7 +16,7 @@ versionCodeOffset = 304 platform :android do before_all do Dir.chdir("../..") do - sh("npm", "ci", "--legacy-peer-deps") + sh("npm", "ci") # Special hack to work-around alpine linux problem - File.getCanonicalPath is failing without a reason: sh("find node_modules -name '*.gradle' -type f -exec sed -i.bak '/canonicalPath/d' {} +") end @@ -74,10 +72,8 @@ platform :android do UI.message "Replacing Firebase API keys from environment variables" Dir.chdir("../app") do - firebaseApiKey1 = ENV["FIREBASE_API_KEY_1"] || "FIREBASE_API_KEY_1" - sh("sed -i 's/{{firebase-api-key-1}}/#{firebaseApiKey1}/g' google-services.json") - firebaseApiKey2 = ENV["FIREBASE_API_KEY_2"] || "FIREBASE_API_KEY_2" - sh("sed -i 's/{{firebase-api-key-2}}/#{firebaseApiKey2}/g' google-services.json") + firebaseApiKey = ENV["FIREBASE_API_KEY"] || "FIREBASE_API_KEY" + sh("sed -i 's/{{firebase-api-key}}/#{firebaseApiKey}/g' google-services.json") end if options[:submit] == true