From 1a262f9707d2815ac4aafea006b271ac41814b05 Mon Sep 17 00:00:00 2001 From: Alfreedom <00tango.bromine@icloud.com> Date: Mon, 22 Jul 2024 14:29:33 +0200 Subject: [PATCH] final modifications --- .github/workflows/release_dapp_android.yml | 4 +- .../release_dapp_android_internal.yml | 63 ++++++++++++++++++ .github/workflows/release_dapp_ios.yml | 1 + .../workflows/release_dapp_ios_internal.yml | 1 + .github/workflows/release_wallet_android.yml | 2 + .../release_wallet_android_internal.yml | 64 +++++++++++++++++++ .github/workflows/release_wallet_ios.yml | 1 + .../workflows/release_wallet_ios_internal.yml | 1 + example/dapp/android/fastlane/Fastfile | 12 ++-- example/dapp/ios/fastlane/Fastfile | 5 +- example/wallet/android/fastlane/Fastfile | 12 ++-- example/wallet/ios/fastlane/Fastfile | 5 +- 12 files changed, 154 insertions(+), 17 deletions(-) create mode 100644 .github/workflows/release_dapp_android_internal.yml create mode 100644 .github/workflows/release_wallet_android_internal.yml diff --git a/.github/workflows/release_dapp_android.yml b/.github/workflows/release_dapp_android.yml index 32e11fc..ce5293c 100644 --- a/.github/workflows/release_dapp_android.yml +++ b/.github/workflows/release_dapp_android.yml @@ -1,4 +1,4 @@ -name: Android Web3Dapp deploy +name: Android Web3Dapp (production) deploy on: workflow_dispatch: @@ -43,10 +43,12 @@ jobs: - name: Fastlane working-directory: example/dapp/android env: + FLAVOR: "production" PROJECT_ID: ${{ secrets.DAPP_PROJECT_ID }} SLACK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }} FIREBASE_DAPP_ID: ${{ secrets.FIREBASE_DAPP_ID }} + DOWNLOAD_URL: ${{ secrets.DOWNLOAD_URL_DAPP }} run: | PUBSPEC_FILE=../../../pubspec.yaml FILE_VALUE=$(echo | grep "^version: " $PUBSPEC_FILE) diff --git a/.github/workflows/release_dapp_android_internal.yml b/.github/workflows/release_dapp_android_internal.yml new file mode 100644 index 0000000..d8570a0 --- /dev/null +++ b/.github/workflows/release_dapp_android_internal.yml @@ -0,0 +1,63 @@ +name: Android Web3Dapp (internal) deploy + +on: + workflow_dispatch: + pull_request: + types: + - closed + +jobs: + build: + if: (github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'develop') || github.event_name == 'workflow_dispatch' + runs-on: macos-latest-xlarge + + steps: + # Checkout the repo + - name: Checkout repository + uses: actions/checkout@v4 + + # Install Java 17 + - name: Install Java 17 + uses: actions/setup-java@v3 + with: + distribution: 'zulu' + java-version: '17' + architecture: x86_64 + cache: 'gradle' + + # Cache Gradle + - name: Cache Gradle + uses: actions/cache@v3 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + ${{ runner.os }}-gradle- + + # Install Flutter and Dependencies + - uses: ./.github/actions/dependencies + + # Fastlane + - name: Fastlane + working-directory: example/dapp/android + env: + FLAVOR: "internal" + PROJECT_ID: ${{ secrets.DAPP_PROJECT_ID }} + SLACK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }} + FIREBASE_DAPP_ID: ${{ secrets.FIREBASE_DAPP_ID_INTERNAL }} + DOWNLOAD_URL: ${{ secrets.DOWNLOAD_URL_DAPP_INTERNAL }} + run: | + PUBSPEC_FILE=../../../pubspec.yaml + FILE_VALUE=$(echo | grep "^version: " $PUBSPEC_FILE) + PARTS=(${FILE_VALUE//:/ }) + FULL_VERSION=${PARTS[1]} + VERSION_NUMBER=(${FULL_VERSION//-/ }) + + fastlane add_plugin firebase_app_distribution + fastlane release_firebase project_id:$PROJECT_ID app_version:$VERSION_NUMBER + +# Launch locally +# act -j build --container-architecture linux/amd64 -P macos-latest-xlarge=-self-hosted --secret-file .github/workflows/.env.secret -W .github/workflows/release_dapp_android.yml diff --git a/.github/workflows/release_dapp_ios.yml b/.github/workflows/release_dapp_ios.yml index 606db73..a346fe4 100644 --- a/.github/workflows/release_dapp_ios.yml +++ b/.github/workflows/release_dapp_ios.yml @@ -60,6 +60,7 @@ jobs: APP_STORE_CONNECT_KEY: ${{ secrets.APP_STORE_CONNECT_KEY }} MATCH_GIT_URL: ${{ secrets.MATCH_GIT_URL }} SLACK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + TESTFLIGHT_URL: ${{ secrets.TESTFLIGHT_URL_DAPP }} run: | PUBSPEC_FILE=../../../pubspec.yaml FILE_VALUE=$(echo | grep "^version: " $PUBSPEC_FILE) diff --git a/.github/workflows/release_dapp_ios_internal.yml b/.github/workflows/release_dapp_ios_internal.yml index 74e501c..54911c4 100644 --- a/.github/workflows/release_dapp_ios_internal.yml +++ b/.github/workflows/release_dapp_ios_internal.yml @@ -60,6 +60,7 @@ jobs: APP_STORE_CONNECT_KEY: ${{ secrets.APP_STORE_CONNECT_KEY }} MATCH_GIT_URL: ${{ secrets.MATCH_GIT_URL }} SLACK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + TESTFLIGHT_URL: ${{ secrets.TESTFLIGHT_URL_DAPP_INTERNAL }} run: | PUBSPEC_FILE=../../../pubspec.yaml FILE_VALUE=$(echo | grep "^version: " $PUBSPEC_FILE) diff --git a/.github/workflows/release_wallet_android.yml b/.github/workflows/release_wallet_android.yml index 0a711c9..12c7436 100644 --- a/.github/workflows/release_wallet_android.yml +++ b/.github/workflows/release_wallet_android.yml @@ -44,10 +44,12 @@ jobs: - name: Fastlane working-directory: example/wallet/android env: + FLAVOR: "production" PROJECT_ID: ${{ secrets.WALLET_PROJECT_ID }} SLACK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }} FIREBASE_WALLET_ID: ${{ secrets.FIREBASE_WALLET_ID }} + DOWNLOAD_URL: ${{ secrets.DOWNLOAD_URL_WALLET }} run: | PUBSPEC_FILE=../../../pubspec.yaml FILE_VALUE=$(echo | grep "^version: " $PUBSPEC_FILE) diff --git a/.github/workflows/release_wallet_android_internal.yml b/.github/workflows/release_wallet_android_internal.yml new file mode 100644 index 0000000..ed9a0d9 --- /dev/null +++ b/.github/workflows/release_wallet_android_internal.yml @@ -0,0 +1,64 @@ +name: Android Web3Wallet deploy + +on: + workflow_dispatch: + pull_request: + types: + - closed + +jobs: + build: + # if: github.event.pull_request.merged == true + if: (github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'develop') || github.event_name == 'workflow_dispatch' + runs-on: macos-latest-xlarge + + steps: + # Checkout the repo + - name: Checkout repository + uses: actions/checkout@v4 + + # Install Java 17 + - name: Install Java 17 + uses: actions/setup-java@v3 + with: + distribution: 'zulu' + java-version: '17' + architecture: x86_64 + cache: 'gradle' + + # Cache Gradle + - name: Cache Gradle + uses: actions/cache@v3 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + ${{ runner.os }}-gradle- + + # Install Flutter and Dependencies + - uses: ./.github/actions/dependencies + + # Fastlane + - name: Fastlane + working-directory: example/wallet/android + env: + FLAVOR: "internal" + PROJECT_ID: ${{ secrets.WALLET_PROJECT_ID }} + SLACK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }} + FIREBASE_WALLET_ID: ${{ secrets.FIREBASE_WALLET_ID_INTERNAL }} + DOWNLOAD_URL: ${{ secrets.DOWNLOAD_URL_WALLET_INTERNAL }} + run: | + PUBSPEC_FILE=../../../pubspec.yaml + FILE_VALUE=$(echo | grep "^version: " $PUBSPEC_FILE) + PARTS=(${FILE_VALUE//:/ }) + FULL_VERSION=${PARTS[1]} + VERSION_NUMBER=(${FULL_VERSION//-/ }) + + fastlane add_plugin firebase_app_distribution + fastlane release_firebase project_id:$PROJECT_ID app_version:$VERSION_NUMBER + +# Launch locally +# act -j build --container-architecture linux/amd64 -P macos-latest-xlarge=-self-hosted --secret-file .github/workflows/.env.secret -W .github/workflows/release_wallet_android.yml diff --git a/.github/workflows/release_wallet_ios.yml b/.github/workflows/release_wallet_ios.yml index 7865fc3..a3b456e 100644 --- a/.github/workflows/release_wallet_ios.yml +++ b/.github/workflows/release_wallet_ios.yml @@ -60,6 +60,7 @@ jobs: APP_STORE_CONNECT_KEY: ${{ secrets.APP_STORE_CONNECT_KEY }} MATCH_GIT_URL: ${{ secrets.MATCH_GIT_URL }} SLACK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + TESTFLIGHT_URL: ${{ secrets.TESTFLIGHT_URL_WALLET }} run: | PUBSPEC_FILE=../../../pubspec.yaml FILE_VALUE=$(echo | grep "^version: " $PUBSPEC_FILE) diff --git a/.github/workflows/release_wallet_ios_internal.yml b/.github/workflows/release_wallet_ios_internal.yml index fbfee97..8a3a6cf 100644 --- a/.github/workflows/release_wallet_ios_internal.yml +++ b/.github/workflows/release_wallet_ios_internal.yml @@ -60,6 +60,7 @@ jobs: APP_STORE_CONNECT_KEY: ${{ secrets.APP_STORE_CONNECT_KEY }} MATCH_GIT_URL: ${{ secrets.MATCH_GIT_URL }} SLACK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + TESTFLIGHT_URL: ${{ secrets.TESTFLIGHT_URL_WALLET_INTERNAL }} run: | PUBSPEC_FILE=../../../pubspec.yaml FILE_VALUE=$(echo | grep "^version: " $PUBSPEC_FILE) diff --git a/example/dapp/android/fastlane/Fastfile b/example/dapp/android/fastlane/Fastfile index 538496c..5edc983 100644 --- a/example/dapp/android/fastlane/Fastfile +++ b/example/dapp/android/fastlane/Fastfile @@ -49,6 +49,8 @@ platform :android do slack_url = ENV['SLACK_URL'] firebase_token = ENV['FIREBASE_TOKEN'] firebase_dapp_id = ENV['FIREBASE_DAPP_ID'] + _flavor = ENV['FLAVOR'] + _download_url = ENV['DOWNLOAD_URL'] _latest_release = firebase_app_distribution_get_latest_release( app: "#{firebase_dapp_id}", @@ -58,32 +60,30 @@ platform :android do _project_id = "#{options[:project_id]}" # gradle(task: 'assemble', build_type: 'Release') - sh "flutter build apk --build-name #{_app_version} --build-number #{_new_build_number} --dart-define='PROJECT_ID=#{_project_id}' --release" + sh "flutter build apk --build-name #{_app_version} --build-number #{_new_build_number} --dart-define='PROJECT_ID=#{_project_id}' --flavor #{_flavor} --release" changelog = read_changelog firebase_app_distribution( app: "#{firebase_dapp_id}", groups: "flutter-team, javascript-team, kotlin-team, rust-team, unity, wc-testers", - android_artifact_path: '../build/app/outputs/flutter-apk/app-release.apk', + android_artifact_path: "../build/app/outputs/flutter-apk/app-#{_flavor}-release.apk", release_notes: changelog, android_artifact_type: "APK", ) slack( - message: "📱 Web3Dapp Flutter #{_app_version} (#{_new_build_number}) for 🤖 Android successfully released!\n\n", + message: "📱 Web3Dapp Flutter #{_app_version}-#{_flavor} (#{_new_build_number}) for 🤖 Android successfully released!\n\n", default_payloads: [], attachment_properties: { fields: [ { title: "CHANGELOG", value: changelog, - # short: true }, { title: "LINK", - value: "https://appdistribution.firebase.dev/i/2c6573f6956fa7b5", - # short: true + value: "#{_download_url}", }, ] } diff --git a/example/dapp/ios/fastlane/Fastfile b/example/dapp/ios/fastlane/Fastfile index 8d14749..6773d1f 100644 --- a/example/dapp/ios/fastlane/Fastfile +++ b/example/dapp/ios/fastlane/Fastfile @@ -53,6 +53,7 @@ platform :ios do match_password = ENV['MATCH_PASSWORD'] slack_url = ENV['SLACK_URL'] app_identifier = ENV['BUNDLE_ID'] + _testflight_url = ENV['TESTFLIGHT_URL'] api_key = app_store_connect_api_key( key_id: options[:app_store_key_id], @@ -124,8 +125,8 @@ platform :ios do value: changelog, }, { - title: "BUNDLE ID", - value: app_identifier, + title: "LINK", + value: "#{_testflight_url}", }, ] } diff --git a/example/wallet/android/fastlane/Fastfile b/example/wallet/android/fastlane/Fastfile index 8cd0f9a..7e81840 100644 --- a/example/wallet/android/fastlane/Fastfile +++ b/example/wallet/android/fastlane/Fastfile @@ -49,6 +49,8 @@ platform :android do slack_url = ENV['SLACK_URL'] firebase_token = ENV['FIREBASE_TOKEN'] firebase_wallet_id = ENV['FIREBASE_WALLET_ID'] + _flavor = ENV['FLAVOR'] + _download_url = ENV['DOWNLOAD_URL'] _latest_release = firebase_app_distribution_get_latest_release( app: "#{firebase_wallet_id}", @@ -58,32 +60,30 @@ platform :android do _project_id = "#{options[:project_id]}" # gradle(task: 'assemble', build_type: 'Release') - sh "flutter build apk --build-name #{_app_version} --build-number #{_new_build_number} --dart-define='PROJECT_ID=#{_project_id}' --release" + sh "flutter build apk --build-name #{_app_version} --build-number #{_new_build_number} --dart-define='PROJECT_ID=#{_project_id}' --flavor #{_flavor} --release" changelog = read_changelog firebase_app_distribution( app: "#{firebase_wallet_id}", groups: "flutter-team, javascript-team, kotlin-team, rust-team, unity, wc-testers", - android_artifact_path: '../build/app/outputs/flutter-apk/app-release.apk', + android_artifact_path: "../build/app/outputs/flutter-apk/app-#{_flavor}-release.apk", release_notes: changelog, android_artifact_type: "APK", ) slack( - message: "🔐 Web3Wallet Flutter #{_app_version} (#{_new_build_number}) for 🤖 Android successfully released!\n\n", + message: "🔐 Web3Wallet Flutter #{_app_version}-#{_flavor} (#{_new_build_number}) for 🤖 Android successfully released!\n\n", default_payloads: [], attachment_properties: { fields: [ { title: "CHANGELOG", value: changelog, - # short: true }, { title: "LINK", - value: "https://appdistribution.firebase.dev/i/2b8b3dce9e2831cd", - # short: true + value: "#{_download_url}", }, ] } diff --git a/example/wallet/ios/fastlane/Fastfile b/example/wallet/ios/fastlane/Fastfile index 0d2d64f..73819ad 100644 --- a/example/wallet/ios/fastlane/Fastfile +++ b/example/wallet/ios/fastlane/Fastfile @@ -53,6 +53,7 @@ platform :ios do match_password = ENV['MATCH_PASSWORD'] slack_url = ENV['SLACK_URL'] app_identifier = ENV['BUNDLE_ID'] + _testflight_url = ENV['TESTFLIGHT_URL'] api_key = app_store_connect_api_key( key_id: options[:app_store_key_id], @@ -123,8 +124,8 @@ platform :ios do value: changelog, }, { - title: "BUNDLE ID", - value: app_identifier, + title: "LINK", + value: "#{_testflight_url}", }, ] }