@@ -130,6 +130,7 @@ jobs:
130130 steps :
131131 - uses : actions/checkout@v4
132132 with :
133+ fetch-depth : 1
133134 ref : ${{ !inputs.skip_version_bump && needs.update-build-version.outputs.commit-hash || (inputs.source_branch || github.ref_name) }}
134135 - name : Setup Node.js
135136 uses : actions/setup-node@v4
@@ -169,7 +170,7 @@ jobs:
169170 uses : ./.github/workflows/setup-node-modules.yml
170171 with :
171172 ref : ${{ needs.prepare.outputs.checkout_ref_for_setup }}
172- fetch-depth : 0
173+ fetch-depth : 1
173174 checkout-submodules : true
174175 platform : ${{ matrix.platform }}
175176 build_name : ${{ inputs.build_name }}
@@ -190,6 +191,9 @@ jobs:
190191 # Android: Cirrus lg (large) runner for 8GB Gradle heap; iOS: Cirrus macOS Tahoe (has Xcode 26.x)
191192 runs-on : ${{ inputs.runner_provider == 'namespace' && (matrix.platform == 'ios' && 'namespace-profile-metamask-ios-build' || 'namespace-profile-metamask-android-build') || (matrix.platform == 'ios' && 'ghcr.io/cirruslabs/macos-runner:tahoe-xl' || 'ghcr.io/cirruslabs/ubuntu-runner-amd64:24.04-lg') }}
192193 environment : ${{ needs.prepare.outputs.github_environment }}
194+ env :
195+ GRADLE_USER_HOME : /home/admin/_work/.gradle
196+ CACHE_GENERATION : v1
193197 steps :
194198 - name : Validate version-bump commit
195199 if : ${{ !inputs.skip_version_bump }}
@@ -375,6 +379,29 @@ jobs:
375379 java-version : ' 17'
376380 distribution : ' temurin'
377381
382+ - name : Apply release Gradle config (Android)
383+ if : matrix.platform == 'android'
384+ run : cp android/gradle.properties.release android/gradle.properties
385+
386+ - name : Restore Gradle dependencies from branch cache (Android)
387+ if : matrix.platform == 'android'
388+ id : gradle-cache-restore
389+ uses : cirruslabs/cache@bba69c6578b863ad0398ad40567bd2ef70290fe0 # v4
390+ with :
391+ path : |
392+ ~/_work/.gradle/caches
393+ ~/_work/.gradle/wrapper
394+ key : gradle-release-${{ github.ref_name }}-${{ env.CACHE_GENERATION }}-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
395+
396+ - name : Restore Gradle dependencies from main cache (Android)
397+ if : matrix.platform == 'android' && steps.gradle-cache-restore.outputs.cache-hit != 'true' && github.ref_name != 'main'
398+ uses : cirruslabs/cache/restore@bba69c6578b863ad0398ad40567bd2ef70290fe0 # v4
399+ with :
400+ path : |
401+ ~/_work/.gradle/caches
402+ ~/_work/.gradle/wrapper
403+ key : gradle-release-main-${{ env.CACHE_GENERATION }}-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
404+
378405 # iOS: Clean up any existing keychains from previous runs
379406 - name : Clean up existing keychains
380407 if : matrix.platform == 'ios' && needs.prepare.outputs.signing_aws_role != ''
@@ -425,6 +452,12 @@ jobs:
425452 timeout-minutes : 115
426453 env :
427454 GIT_BRANCH : ${{ inputs.source_branch || github.ref_name }}
455+ # React Native 0.81's ReactAndroid/build.gradle.kts requests CMake 3.30.5
456+ # via `System.getenv("CMAKE_VERSION") ?: "3.30.5"`. The self-hosted runner
457+ # only ships CMake 3.22.1 in /opt/android-sdk/cmake/ and AGP cannot auto-
458+ # download missing components, causing CXX1300. RN's CMakeLists.txt files
459+ # only require >= 3.13, so 3.22.1 is fully sufficient.
460+ CMAKE_VERSION : ' 3.22.1'
428461 uses : nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3.0.2
429462 with :
430463 timeout_minutes : 55
@@ -541,6 +574,7 @@ jobs:
541574 steps :
542575 - uses : actions/checkout@v4
543576 with :
577+ fetch-depth : 1
544578 ref : ${{ needs.prepare.outputs.checkout_ref_for_setup }}
545579
546580 - name : Setup Node.js
0 commit comments