From 111bd59db5ddeb2201de7f88fce14d2f4223432e Mon Sep 17 00:00:00 2001 From: Fabrizio Cucci Date: Tue, 3 Mar 2026 12:17:33 +0000 Subject: [PATCH] Introduce 'Determine Hermes build flag' step --- .github/actions/build-android/action.yml | 27 ++++++++++++++++-------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/.github/actions/build-android/action.yml b/.github/actions/build-android/action.yml index e1c4abe313e..521f2ea8aa3 100644 --- a/.github/actions/build-android/action.yml +++ b/.github/actions/build-android/action.yml @@ -31,6 +31,23 @@ runs: if: ${{ !endsWith(github.ref_name, '-stable') && !endsWith(github.base_ref || '', '-stable') || endsWith(github.ref_name, '-stable') && steps.read-rn-version.outputs.rn-version == '1000.0.0' }} shell: bash run: node ./scripts/releases/set-rn-artifacts-version.js --build-type ${{ inputs.release-type }} + - name: Determine Hermes build flag + id: hermes-flag + shell: bash + run: | + if [[ "${{ inputs.release-type }}" == "dry-run" ]]; then + # Use stable Hermes on stable branches, nightly Hermes on main + if [[ "${{ github.ref_name }}" == *"-stable" ]] || [[ "${{ github.base_ref }}" == *"-stable" ]]; then + echo "ORG_GRADLE_PROJECT_react.internal.useHermesStable=true" >> $GITHUB_ENV + else + echo "ORG_GRADLE_PROJECT_react.internal.useHermesNightly=true" >> $GITHUB_ENV + fi + elif [[ "${{ inputs.release-type }}" == "nightly" ]]; then + echo "ORG_GRADLE_PROJECT_react.internal.useHermesNightly=true" >> $GITHUB_ENV + else + # release + echo "ORG_GRADLE_PROJECT_react.internal.useHermesStable=true" >> $GITHUB_ENV + fi - name: Setup gradle uses: ./.github/actions/setup-gradle with: @@ -54,24 +71,16 @@ runs: if [[ "${{ inputs.release-type }}" == "dry-run" ]]; then # dry-run: we only build ARM64 to save time/resources. For release/nightlies the default is to build all archs. export ORG_GRADLE_PROJECT_reactNativeArchitectures="arm64-v8a,x86" # x86 is required for E2E testing - # Use stable Hermes on stable branches, nightly Hermes on main - if [[ "${{ github.ref_name }}" == *"-stable" ]] || [[ "${{ github.base_ref }}" == *"-stable" ]]; then - export HERMES_PREBUILT_FLAG="ORG_GRADLE_PROJECT_react.internal.useHermesStable=true" - else - export HERMES_PREBUILT_FLAG="ORG_GRADLE_PROJECT_react.internal.useHermesNightly=true" - fi TASKS="publishAllToMavenTempLocal build" elif [[ "${{ inputs.release-type }}" == "nightly" ]]; then # nightly: we set isSnapshot to true so artifacts are sent to the right repository on Maven Central. export ORG_GRADLE_PROJECT_isSnapshot="true" - export HERMES_PREBUILT_FLAG="ORG_GRADLE_PROJECT_react.internal.useHermesNightly=true" TASKS="publishAllToMavenTempLocal publishAndroidToSonatype build" else # release: we want to build all archs (default) - export HERMES_PREBUILT_FLAG="ORG_GRADLE_PROJECT_react.internal.useHermesStable=true" TASKS="publishAllToMavenTempLocal publishAndroidToSonatype build" fi - env "$HERMES_PREBUILT_FLAG" ./gradlew $TASKS -PenableWarningsAsErrors=true + ./gradlew $TASKS -PenableWarningsAsErrors=true - name: Save Android ccache if: ${{ github.ref == 'refs/heads/main' || contains(github.ref, '-stable') }} uses: actions/cache/save@v5