diff --git a/.github/workflows/release-android-base.yaml b/.github/workflows/release-android-base.yaml index 0a2a2cef..5e9b4af9 100644 --- a/.github/workflows/release-android-base.yaml +++ b/.github/workflows/release-android-base.yaml @@ -1,6 +1,7 @@ name: release-android-base permissions: + id-token: write contents: read on: @@ -18,6 +19,10 @@ on: description: 'Release type of the project (debug/internal/production)' default: 'internal' type: string + project-type: + description: 'Type of project (wallet/dapp)' + required: true + type: string output-path: description: 'Path to get the APK file' required: true @@ -45,6 +50,13 @@ on: required: true google-services-file: required: false + aws-account-id: + required: true + slack-webhook-url: + required: true + firebase-url: + description: 'Firebase URL of the project' + required: false jobs: build: @@ -90,16 +102,18 @@ jobs: echo "org.gradle.caching=true" >> ${{ inputs.root-path }}/android/gradle.properties - name: Cache Gradle - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: | ~/.gradle/caches ~/.gradle/wrapper - key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + ${{ inputs.root-path }}/android/.gradle + key: ${{ runner.os }}-gradle-${{ inputs.name }}-${{ hashFiles(format('{0}/android/**/*.gradle*', inputs.root-path), format('{0}/android/**/gradle-wrapper.properties', inputs.root-path)) }} restore-keys: | - ${{ runner.os }}-gradle- + ${{ runner.os }}-gradle-${{ inputs.name }}- - name: Build APK + id: build run: | if [ ${{ inputs.release-type }} = 'internal' ]; then cd ${{ inputs.root-path }} && yarn install && yarn run android:build:internal @@ -113,9 +127,80 @@ jobs: tools-version: 13.0.1 gcp_sa_key: ${{ secrets.gsa-key }} - - name: Upload APK + - name: Upload APK to Firebase + id: firebase-upload + continue-on-error: false env: APP_ID: ${{ secrets.firebase-app-id }} run: | - firebase appdistribution:distribute ${{ inputs.output-path }} --app $APP_ID --release-notes "${{ inputs.name }} ${{ inputs.release-type }} release" --groups "flutter-team, javascript-team, kotlin-team, unity, rust-team, swift-team, wc-testers" - \ No newline at end of file + firebase appdistribution:distribute ${{ inputs.output-path }} \ + --app $APP_ID \ + --release-notes "${{ inputs.name }} (${{ inputs.project-type }}) - ${{ inputs.release-type }} - Branch: ${{ github.ref_name }}" \ + --groups "flutter-team, javascript-team, kotlin-team, unity, rust-team, swift-team, wc-testers" + + - name: Configure AWS credentials + id: aws-creds + continue-on-error: true + uses: aws-actions/configure-aws-credentials@00943011d9042930efac3dcd3a170e4273319bc8 + with: + role-to-assume: arn:aws:iam::${{ secrets.aws-account-id }}:role/prod-github-actions-react-native-builds + aws-region: eu-central-1 + output-env-credentials: false + output-credentials: true + + - name: Upload Android build to S3 + id: s3-upload + env: + AWS_REGION: eu-central-1 + AWS_ACCESS_KEY_ID: ${{ steps.aws-creds.outputs.aws-access-key-id }} + AWS_SECRET_ACCESS_KEY: ${{ steps.aws-creds.outputs.aws-secret-access-key }} + AWS_SESSION_TOKEN: ${{ steps.aws-creds.outputs.aws-session-token }} + continue-on-error: true + run: | + aws s3 cp \ + ${{ inputs.output-path }} \ + s3://walletconnect.react-native-builds.prod/android/${{ inputs.release-type }}/${{ inputs.project-type }}-${{ inputs.release-type }}.apk + + - name: Send Slack notification + if: always() && !cancelled() + uses: slackapi/slack-github-action@v2.1.0 + with: + webhook: ${{ secrets.slack-webhook-url }} + webhook-type: incoming-webhook + payload: | + { + "text": "Android Build Report - ${{ inputs.name }} - ${{ inputs.release-type }}", + "blocks": [ + { + "type": "header", + "text": { "type": "plain_text", "text": "🤖 Android Build Report" } + }, + { + "type": "section", + "fields": [ + { "type": "mrkdwn", "text": "*Project:*\n`${{ inputs.name }}`" }, + { "type": "mrkdwn", "text": "*Release Type:*\n`${{ inputs.release-type }}`" }, + { "type": "mrkdwn", "text": "*Branch:*\n`${{ github.ref_name }}`" } + ] + }, + { + "type": "section", + "fields": [ + { "type": "mrkdwn", "text": "*Build:*\n`${{ steps.build.outcome == 'success' && '✅ Success' || '❌ Failed' }}`" }, + { "type": "mrkdwn", "text": "*Firebase Upload:*\n`${{ steps.firebase-upload.outcome == 'success' && '✅ Success' || steps.firebase-upload.outcome == 'failure' && '❌ Failed' || '⏭️ Skipped' }}`" }, + { "type": "mrkdwn", "text": "*S3 Upload:*\n`${{ steps.s3-upload.outcome == 'success' && '✅ Success' || steps.s3-upload.outcome == 'failure' && '❌ Failed' || '⏭️ Skipped' }}`" }, + { "type": "mrkdwn", "text": "*Overall Status:*\n`${{ job.status == 'success' && '✅ Success' || '❌ Failed' }}`" } + ] + }, + { + "type": "actions", + "elements": [ + { + "type": "button", + "text": { "type": "plain_text", "text": "View Workflow Run" }, + "url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" + }${{ steps.build.outcome == 'success' && steps.firebase-upload.outcome == 'success' && secrets.firebase-url != '' && format(',{{"type":"button","text":{{"type":"plain_text","text":"View in Firebase"}},"url":"{0}"}}', secrets.firebase-url) || '' }} + ] + } + ] + } \ No newline at end of file diff --git a/.github/workflows/release-dapp-android-internal.yaml b/.github/workflows/release-dapp-android-internal.yaml index 75e3e1e4..338174b9 100644 --- a/.github/workflows/release-dapp-android-internal.yaml +++ b/.github/workflows/release-dapp-android-internal.yaml @@ -1,6 +1,7 @@ name: release-android-appkit-internal permissions: + id-token: write contents: read on: workflow_dispatch @@ -12,6 +13,7 @@ jobs: name: AppKit React Native root-path: 'dapps/W3MWagmi' release-type: 'internal' + project-type: 'dapp' output-path: 'dapps/W3MWagmi/android/app/build/outputs/apk/internal/app-internal.apk' secrets: project-id: ${{ secrets.ENV_PROJECT_ID }} @@ -23,3 +25,6 @@ jobs: gsa-key: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_KEY }} keystore-name: ${{ secrets.WC_INTERNAL_KEYSTORE_NAME }} keystore: ${{ secrets.WC_INTERNAL_KEYSTORE }} + aws-account-id: ${{ secrets.AWS_ACCOUNT_ID }} + slack-webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }} + firebase-url: ${{ secrets.FIREBASE_APPKIT_INTERNAL_URL }} \ No newline at end of file diff --git a/.github/workflows/release-dapp-android-production.yaml b/.github/workflows/release-dapp-android-production.yaml index 25296fee..d0c30263 100644 --- a/.github/workflows/release-dapp-android-production.yaml +++ b/.github/workflows/release-dapp-android-production.yaml @@ -1,6 +1,7 @@ name: release-android-appkit-production permissions: + id-token: write contents: read on: workflow_dispatch @@ -12,6 +13,7 @@ jobs: name: AppKit React Native root-path: 'dapps/W3MWagmi' release-type: 'production' + project-type: 'dapp' output-path: 'dapps/W3MWagmi/android/app/build/outputs/apk/release/app-release.apk' secrets: project-id: ${{ secrets.ENV_PROJECT_ID }} @@ -23,3 +25,6 @@ jobs: gsa-key: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_KEY }} keystore-name: ${{ vars.WC_PROD_KEYSTORE_NAME }} keystore: ${{ secrets.WC_PROD_KEYSTORE }} + aws-account-id: ${{ secrets.AWS_ACCOUNT_ID }} + slack-webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }} + firebase-url: ${{ secrets.FIREBASE_APPKIT_PROD_URL }} diff --git a/.github/workflows/release-dapp-ios-internal.yaml b/.github/workflows/release-dapp-ios-internal.yaml index f5967184..7138ac73 100644 --- a/.github/workflows/release-dapp-ios-internal.yaml +++ b/.github/workflows/release-dapp-ios-internal.yaml @@ -1,9 +1,17 @@ name: release-ios-appkit-internal permissions: + id-token: write contents: read -on: workflow_dispatch +on: + workflow_dispatch: + inputs: + build-for-simulator: + description: "Build for simulator instead of TestFlight" + required: false + default: false + type: boolean jobs: release-internal: @@ -17,6 +25,8 @@ jobs: scheme-name: 'W3MWagmi Internal' bundle-id: 'com.walletconnect.web3modal.rnsample.internal' apple-id: '6479817037' + project-type: 'dapp' + build-for-simulator: ${{ inputs.build-for-simulator }} secrets: project-id: ${{ secrets.ENV_PROJECT_ID }} relay-url: ${{ secrets.ENV_RELAY_URL }} @@ -30,4 +40,7 @@ jobs: match-keychain-password: ${{ secrets.MATCH_KEYCHAIN_PASSWORD }} match-git-url: ${{ secrets.MATCH_GIT_URL }} match-ssh-key: ${{ secrets.MATCH_SSH_KEY }} + aws-account-id: ${{ secrets.AWS_ACCOUNT_ID }} + slack-webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }} + testflight-url: ${{ secrets.TESTFLIGHT_APPKIT_INTERNAL_URL }} diff --git a/.github/workflows/release-dapp-ios-production.yaml b/.github/workflows/release-dapp-ios-production.yaml index a1c524c9..04830ffb 100644 --- a/.github/workflows/release-dapp-ios-production.yaml +++ b/.github/workflows/release-dapp-ios-production.yaml @@ -1,9 +1,17 @@ name: release-ios-appkit-production permissions: + id-token: write contents: read -on: workflow_dispatch +on: + workflow_dispatch: + inputs: + build-for-simulator: + description: "Build for simulator instead of TestFlight" + required: false + default: false + type: boolean jobs: release-production: @@ -17,6 +25,8 @@ jobs: scheme-name: 'W3MWagmi' bundle-id: 'com.walletconnect.web3modal.rnsample' apple-id: '6446700301' + project-type: 'dapp' + build-for-simulator: ${{ inputs.build-for-simulator }} secrets: project-id: ${{ secrets.ENV_PROJECT_ID }} relay-url: ${{ secrets.ENV_RELAY_URL }} @@ -30,4 +40,7 @@ jobs: match-keychain-password: ${{ secrets.MATCH_KEYCHAIN_PASSWORD }} match-git-url: ${{ secrets.MATCH_GIT_URL }} match-ssh-key: ${{ secrets.MATCH_SSH_KEY }} + aws-account-id: ${{ secrets.AWS_ACCOUNT_ID }} + slack-webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }} + testflight-url: ${{ secrets.TESTFLIGHT_APPKIT_PROD_URL }} diff --git a/.github/workflows/release-ios-base.yaml b/.github/workflows/release-ios-base.yaml index 735bc32f..10d99278 100644 --- a/.github/workflows/release-ios-base.yaml +++ b/.github/workflows/release-ios-base.yaml @@ -1,48 +1,58 @@ name: release-ios-base permissions: + id-token: write contents: read on: workflow_call: inputs: name: - description: 'Name of the project' + description: "Name of the project" required: true type: string root-path: - description: 'Path of the react-native project' + description: "Path of the react-native project" required: true type: string xcode-project-path: - description: 'Path of the Xcode project' + description: "Path of the Xcode project" required: true type: string xcode-workspace-path: - description: 'Path of the Xcode workspace' + description: "Path of the Xcode workspace" required: true type: string release-type: - description: 'Release type of the project (debug/internal/production)' + description: "Release type of the project (debug/internal/production)" + type: string + project-type: + description: "Type of project (wallet/dapp)" + required: true type: string scheme-name: - description: 'Scheme name of the project' + description: "Scheme name of the project" required: true type: string bundle-id: - description: 'Bundle ID of the project' + description: "Bundle ID of the project" required: true type: string apple-id: - description: 'App ID of the project' + description: "App ID of the project" required: true type: string + build-for-simulator: + description: "Build for simulator instead of TestFlight" + required: false + default: false + type: boolean secrets: project-id: - description: 'WalletConnect Cloud ID' + description: "WalletConnect Cloud ID" required: true relay-url: - description: 'WalletConnect Relay URL' + description: "WalletConnect Relay URL" required: false sentry-dsn: required: true @@ -66,6 +76,13 @@ on: required: true google-services-file: required: false + aws-account-id: + required: true + slack-webhook-url: + required: true + testflight-url: + description: "TestFlight URL of the project" + required: false jobs: build: @@ -84,13 +101,6 @@ jobs: with: root-path: ${{ inputs.root-path }} - - name: Set Xcode Version - run: | - sudo xcode-select -s /Applications/Xcode_16.2.app - xcodebuild -version - xcodebuild -showsdks - sudo xcodebuild -downloadPlatform iOS - - name: Set podfile path id: podfile-hash run: | @@ -101,10 +111,12 @@ jobs: - name: Cache pods id: pods-cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ${{ inputs.root-path }}/ios/Pods - key: ${{ runner.os }}-pods-${{ hashFiles(env.podfile_path) }} + key: ${{ runner.os }}-pods-${{ github.ref_name }}-${{ hashFiles(env.podfile_path) }} + restore-keys: | + ${{ runner.os }}-pods-${{ github.ref_name }}- - name: Install Ruby uses: ruby/setup-ruby@v1 @@ -127,10 +139,11 @@ jobs: if: ${{ env.google-services-file != '' }} run: echo ${{ env.google-services-file }} | base64 --decode >> ${{ inputs.root-path }}/ios/GoogleService-Info.plist - - name: Build and Upload to App Store + - name: ${{ inputs.build-for-simulator && 'Build for simulator' || 'Build and Upload to TestFlight' }} + id: build uses: maierj/fastlane-action@v3.0.0 with: - lane: 'release_testflight' + lane: ${{ inputs.build-for-simulator && 'build_for_simulator' || 'release_testflight' }} env: APPLE_ID: ${{ inputs.apple-id }} APPLE_USERNAME: ${{ secrets.apple-username }} @@ -145,3 +158,75 @@ jobs: SCHEME: ${{ inputs.scheme-name }} XCODE_PROJECT_PATH: ${{ inputs.xcode-project-path }} XCWORKSPACE_PATH: ${{ inputs.xcode-workspace-path }} + PROJECT_TYPE: ${{ inputs.project-type }} + RELEASE_TYPE: ${{ inputs.release-type }} + BRANCH_NAME: ${{ github.ref_name }} + BUILD_FOR_SIMULATOR: ${{ inputs.build-for-simulator }} + + - name: Configure AWS credentials + id: aws-creds + continue-on-error: true + uses: aws-actions/configure-aws-credentials@00943011d9042930efac3dcd3a170e4273319bc8 + with: + role-to-assume: arn:aws:iam::${{ secrets.aws-account-id }}:role/prod-github-actions-react-native-builds + aws-region: eu-central-1 + output-env-credentials: false + output-credentials: true + + - name: Upload iOS build to S3 + if: ${{ inputs.build-for-simulator == true }} # Upload to bucket only for simulator builds + id: s3-upload + env: + AWS_REGION: eu-central-1 + AWS_ACCESS_KEY_ID: ${{ steps.aws-creds.outputs.aws-access-key-id }} + AWS_SECRET_ACCESS_KEY: ${{ steps.aws-creds.outputs.aws-secret-access-key }} + AWS_SESSION_TOKEN: ${{ steps.aws-creds.outputs.aws-session-token }} + continue-on-error: true + run: | + aws s3 cp \ + ./build/${{ inputs.project-type }}-${{ inputs.release-type }}.ipa \ + s3://walletconnect.react-native-builds.prod/ios/${{ inputs.release-type }}/${{ inputs.project-type }}-${{ inputs.release-type }}.ipa + + - name: Send Slack notification + if: always() && !cancelled() + uses: slackapi/slack-github-action@v2.1.0 + with: + webhook: ${{ secrets.slack-webhook-url }} + webhook-type: incoming-webhook + payload: | + { + "text": "iOS Build Report - ${{ inputs.name }} - ${{ inputs.release-type }}", + "blocks": [ + { + "type": "header", + "text": { "type": "plain_text", "text": "🍎 iOS Build Report" } + }, + { + "type": "section", + "fields": [ + { "type": "mrkdwn", "text": "*Project:*\n`${{ inputs.name }}`" }, + { "type": "mrkdwn", "text": "*Release Type:*\n`${{ inputs.release-type }}`" }, + { "type": "mrkdwn", "text": "*Branch:*\n`${{ github.ref_name }}`" }, + { "type": "mrkdwn", "text": "*Build for Simulator:*\n`${{ inputs.build-for-simulator }}`" } + ] + }, + { + "type": "section", + "fields": [ + { "type": "mrkdwn", "text": "*Build & TestFlight:*\n`${{ steps.build.outcome == 'success' && '✅ Success' || '❌ Failed' }}`" }, + { "type": "mrkdwn", "text": "*S3 Upload:*\n`${{ steps.s3-upload.outcome == 'success' && '✅ Success' || steps.s3-upload.outcome == 'failure' && '❌ Failed' || '⏭️ Skipped' }}`" }, + { "type": "mrkdwn", "text": "*Overall Status:*\n`${{ job.status == 'success' && '✅ Success' || '❌ Failed' }}`" } + ] + }, + { + "type": "actions", + "elements": [ + { + "type": "button", + "text": { "type": "plain_text", "text": "View Workflow Run" }, + "url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" + }${{ steps.build.outcome == 'success' && secrets.testflight-url != '' && format(',{{"type":"button","text":{{"type":"plain_text","text":"View in TestFlight"}},"url":"{0}"}}', secrets.testflight-url) || '' }} + ] + } + ] + } diff --git a/.github/workflows/release-wallet-android-internal.yaml b/.github/workflows/release-wallet-android-internal.yaml index 47f7a21b..2f471eb9 100644 --- a/.github/workflows/release-wallet-android-internal.yaml +++ b/.github/workflows/release-wallet-android-internal.yaml @@ -1,6 +1,7 @@ name: release-android-walletkit-internal permissions: + id-token: write contents: read on: workflow_dispatch @@ -12,6 +13,7 @@ jobs: name: WalletKit React Native root-path: 'wallets/rn_cli_wallet' release-type: 'internal' + project-type: 'wallet' output-path: 'wallets/rn_cli_wallet/android/app/build/outputs/apk/internal/app-internal.apk' secrets: project-id: ${{ secrets.ENV_WALLET_PROJECT_ID }} @@ -24,3 +26,6 @@ jobs: keystore-name: ${{ secrets.WC_INTERNAL_KEYSTORE_NAME }} keystore: ${{ secrets.WC_INTERNAL_KEYSTORE }} google-services-file: ${{ secrets.ANDROID_GOOGLE_SERVICES_BASE64 }} + aws-account-id: ${{ secrets.AWS_ACCOUNT_ID }} + slack-webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }} + firebase-url: ${{ secrets.FIREBASE_WALLETKIT_INTERNAL_URL }} diff --git a/.github/workflows/release-wallet-android-production.yaml b/.github/workflows/release-wallet-android-production.yaml index d966539b..2456f2ec 100644 --- a/.github/workflows/release-wallet-android-production.yaml +++ b/.github/workflows/release-wallet-android-production.yaml @@ -1,6 +1,7 @@ name: release-android-walletkit-production permissions: + id-token: write contents: read on: workflow_dispatch @@ -12,6 +13,7 @@ jobs: name: WalletKit React Native root-path: 'wallets/rn_cli_wallet' release-type: 'production' + project-type: 'wallet' output-path: 'wallets/rn_cli_wallet/android/app/build/outputs/apk/release/app-release.apk' secrets: project-id: ${{ secrets.ENV_WALLET_PROJECT_ID }} @@ -24,3 +26,6 @@ jobs: keystore-name: ${{ vars.WC_PROD_KEYSTORE_NAME }} keystore: ${{ secrets.WC_PROD_KEYSTORE }} google-services-file: ${{ secrets.ANDROID_GOOGLE_SERVICES_BASE64 }} + aws-account-id: ${{ secrets.AWS_ACCOUNT_ID }} + slack-webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }} + firebase-url: ${{ secrets.FIREBASE_WALLETKIT_PROD_URL }} diff --git a/.github/workflows/release-wallet-ios-internal.yaml b/.github/workflows/release-wallet-ios-internal.yaml index ded6359e..7f3d67d7 100644 --- a/.github/workflows/release-wallet-ios-internal.yaml +++ b/.github/workflows/release-wallet-ios-internal.yaml @@ -1,9 +1,17 @@ name: release-ios-walletkit-internal permissions: + id-token: write contents: read -on: workflow_dispatch +on: + workflow_dispatch: + inputs: + build-for-simulator: + description: "Build for simulator instead of TestFlight" + required: false + default: false + type: boolean jobs: release-internal: @@ -17,6 +25,8 @@ jobs: scheme-name: 'RNWallet-Internal' bundle-id: 'com.walletconnect.web3wallet.rnsample.internal' apple-id: '6499165794' + project-type: 'wallet' + build-for-simulator: ${{ inputs.build-for-simulator }} secrets: project-id: ${{ secrets.ENV_WALLET_PROJECT_ID }} relay-url: ${{ secrets.ENV_RELAY_URL }} @@ -31,3 +41,6 @@ jobs: match-git-url: ${{ secrets.MATCH_GIT_URL }} match-ssh-key: ${{ secrets.MATCH_SSH_KEY }} google-services-file: ${{ secrets.W3W_IOS_INTERNAL_GOOGLE_SERVICES_FILE }} + aws-account-id: ${{ secrets.AWS_ACCOUNT_ID }} + slack-webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }} + testflight-url: ${{ secrets.TESTFLIGHT_WALLETKIT_INTERNAL_URL }} diff --git a/.github/workflows/release-wallet-ios-production.yaml b/.github/workflows/release-wallet-ios-production.yaml index 5371f3ff..e6afce5e 100644 --- a/.github/workflows/release-wallet-ios-production.yaml +++ b/.github/workflows/release-wallet-ios-production.yaml @@ -1,9 +1,17 @@ name: release-ios-walletkit-production permissions: + id-token: write contents: read -on: workflow_dispatch +on: + workflow_dispatch: + inputs: + build-for-simulator: + description: "Build for simulator instead of TestFlight" + required: false + default: false + type: boolean jobs: release-production: @@ -17,6 +25,8 @@ jobs: scheme-name: 'RNWallet' bundle-id: 'com.walletconnect.web3wallet.rnsample' apple-id: '6449264964' + project-type: 'wallet' + build-for-simulator: ${{ inputs.build-for-simulator }} secrets: project-id: ${{ secrets.ENV_WALLET_PROJECT_ID }} relay-url: ${{ secrets.ENV_RELAY_URL }} @@ -31,3 +41,6 @@ jobs: match-git-url: ${{ secrets.MATCH_GIT_URL }} match-ssh-key: ${{ secrets.MATCH_SSH_KEY }} google-services-file: ${{ secrets.W3W_IOS_PROD_GOOGLE_SERVICES_FILE }} + aws-account-id: ${{ secrets.AWS_ACCOUNT_ID }} + slack-webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }} + testflight-url: ${{ secrets.TESTFLIGHT_WALLETKIT_PROD_URL }} \ No newline at end of file diff --git a/fastlane/Fastfile b/fastlane/Fastfile index d13b6f00..72b9ac97 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -23,6 +23,9 @@ platform :ios do # Setup the keychain and match to work with CI setup_ci() + project_type = ENV['PROJECT_TYPE'] || ENV['SCHEME'] + branch_name = ENV['BRANCH_NAME'] || '' + # Get Apple API Key api_key = app_store_connect_api_key( key_id: ENV["APPLE_KEY_ID"], @@ -70,20 +73,81 @@ platform :ios do workspace: ENV['XCWORKSPACE_PATH'], scheme: ENV['SCHEME'], export_method: "app-store", + output_directory: "./build", + output_name: "#{ENV['PROJECT_TYPE']}-#{ENV['RELEASE_TYPE']}.ipa" ) # Upload to TestFlight upload_to_testflight( apple_id: ENV["APPLE_ID"], app_identifier: ENV["BUNDLE_ID"], - changelog: "#{ENV["SCHEME"]} build 🚀", - distribute_external: false, - notify_external_testers: false, + changelog: "#{project_type} build from branch: #{branch_name}", + distribute_external: true, + notify_external_testers: true, skip_waiting_for_build_processing: true ) - clean_build_artifacts() + # Only clean artifacts when running locally (not in CI) + clean_build_artifacts() unless ENV['CI'] end + lane :build_for_simulator do |options| + + project_type = ENV['PROJECT_TYPE'] || ENV['SCHEME'] + + # Install pods + cocoapods( + clean_install: false, + repo_update: true, + podfile: ENV['PODFILE_PATH'] + ) + + # Build for simulator without code signing + archive_path = "./build/#{ENV['PROJECT_TYPE']}-#{ENV['RELEASE_TYPE']}.xcarchive" + + gym( + workspace: ENV['XCWORKSPACE_PATH'], + scheme: ENV['SCHEME'], + configuration: "Release", + destination: "generic/platform=iOS Simulator", + archive_path: archive_path, + skip_codesigning: true, + skip_package_ipa: true, + ) + + # Find the .app in the archive + products_path = ".#{archive_path}/Products/Applications" + app_paths = Dir.glob("#{products_path}/*.app") + app_path = app_paths.first + + if app_path + output_name = "#{ENV['PROJECT_TYPE']}-#{ENV['RELEASE_TYPE']}.ipa" + build_dir = File.expand_path('../build') + + # Ensure build directory exists + sh("mkdir -p #{build_dir}") + + # Create Payload directory structure + payload_dir = "#{build_dir}/Payload" + sh("rm -rf '#{payload_dir}'") # Clean any existing Payload + sh("mkdir -p '#{payload_dir}'") + + # Copy .app into Payload + sh("cp -r '#{app_path}' '#{payload_dir}/'") + + # Create IPA by zipping Payload directory + sh("cd '#{build_dir}' && zip -r '#{output_name}' Payload") + + # Clean up Payload directory + sh("rm -rf '#{payload_dir}'") + + UI.success("✅ Created simulator build: #{build_dir}/#{output_name}") + else + UI.user_error!("Could not find .app bundle in #{products_path}") + end + + # Only clean artifacts when running locally (not in CI) + clean_build_artifacts() unless ENV['CI'] + end end diff --git a/fastlane/README.md b/fastlane/README.md index 8b40179f..977fbcd1 100644 --- a/fastlane/README.md +++ b/fastlane/README.md @@ -23,6 +23,14 @@ For _fastlane_ installation instructions, see [Installing _fastlane_](https://do +### ios build_for_simulator + +```sh +[bundle exec] fastlane ios build_for_simulator +``` + + + ---- This README.md is auto-generated and will be re-generated every time [_fastlane_](https://fastlane.tools) is run. diff --git a/wallets/rn_cli_wallet/android/gradle.properties b/wallets/rn_cli_wallet/android/gradle.properties index 87585a64..3334629c 100644 --- a/wallets/rn_cli_wallet/android/gradle.properties +++ b/wallets/rn_cli_wallet/android/gradle.properties @@ -25,7 +25,7 @@ android.useAndroidX=true # Use this property to specify which architecture you want to build. # You can also override it from the CLI using # ./gradlew -PreactNativeArchitectures=x86_64 -reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64 +reactNativeArchitectures=arm64-v8a,x86_64 # Use this property to enable support to the new architecture. # This will allow you to use TurboModules and the Fabric render in diff --git a/wallets/rn_cli_wallet/package.json b/wallets/rn_cli_wallet/package.json index 807dd94b..b99a4384 100644 --- a/wallets/rn_cli_wallet/package.json +++ b/wallets/rn_cli_wallet/package.json @@ -4,8 +4,8 @@ "private": true, "scripts": { "android": "yarn run copy:debug && react-native run-android --mode=debug --appId com.walletconnect.web3wallet.rnsample.debug", - "android:build": "yarn run copy:production && cd android && ./gradlew clean && ./gradlew assembleRelease -PreactNativeArchitectures=arm64-v8a", - "android:build:internal": "yarn run copy:internal && cd android && ./gradlew clean && ./gradlew assembleInternal -PreactNativeArchitectures=arm64-v8a", + "android:build": "yarn run copy:production && cd android && ./gradlew clean && ./gradlew assembleRelease", + "android:build:internal": "yarn run copy:internal && cd android && ./gradlew clean && ./gradlew assembleInternal", "ios": "react-native run-ios --scheme 'RNWallet-Debug'", "ios:internal": "react-native run-ios --scheme 'RNWallet-Internal'", "bundle:ios": "react-native bundle --entry-file='index.js' --bundle-output='./ios/main.jsbundle' --dev=false --platform='ios'",