Skip to content

Commit 111bd59

Browse files
committed
Introduce 'Determine Hermes build flag' step
1 parent 9f335b0 commit 111bd59

1 file changed

Lines changed: 18 additions & 9 deletions

File tree

.github/actions/build-android/action.yml

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,23 @@ runs:
3131
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' }}
3232
shell: bash
3333
run: node ./scripts/releases/set-rn-artifacts-version.js --build-type ${{ inputs.release-type }}
34+
- name: Determine Hermes build flag
35+
id: hermes-flag
36+
shell: bash
37+
run: |
38+
if [[ "${{ inputs.release-type }}" == "dry-run" ]]; then
39+
# Use stable Hermes on stable branches, nightly Hermes on main
40+
if [[ "${{ github.ref_name }}" == *"-stable" ]] || [[ "${{ github.base_ref }}" == *"-stable" ]]; then
41+
echo "ORG_GRADLE_PROJECT_react.internal.useHermesStable=true" >> $GITHUB_ENV
42+
else
43+
echo "ORG_GRADLE_PROJECT_react.internal.useHermesNightly=true" >> $GITHUB_ENV
44+
fi
45+
elif [[ "${{ inputs.release-type }}" == "nightly" ]]; then
46+
echo "ORG_GRADLE_PROJECT_react.internal.useHermesNightly=true" >> $GITHUB_ENV
47+
else
48+
# release
49+
echo "ORG_GRADLE_PROJECT_react.internal.useHermesStable=true" >> $GITHUB_ENV
50+
fi
3451
- name: Setup gradle
3552
uses: ./.github/actions/setup-gradle
3653
with:
@@ -54,24 +71,16 @@ runs:
5471
if [[ "${{ inputs.release-type }}" == "dry-run" ]]; then
5572
# dry-run: we only build ARM64 to save time/resources. For release/nightlies the default is to build all archs.
5673
export ORG_GRADLE_PROJECT_reactNativeArchitectures="arm64-v8a,x86" # x86 is required for E2E testing
57-
# Use stable Hermes on stable branches, nightly Hermes on main
58-
if [[ "${{ github.ref_name }}" == *"-stable" ]] || [[ "${{ github.base_ref }}" == *"-stable" ]]; then
59-
export HERMES_PREBUILT_FLAG="ORG_GRADLE_PROJECT_react.internal.useHermesStable=true"
60-
else
61-
export HERMES_PREBUILT_FLAG="ORG_GRADLE_PROJECT_react.internal.useHermesNightly=true"
62-
fi
6374
TASKS="publishAllToMavenTempLocal build"
6475
elif [[ "${{ inputs.release-type }}" == "nightly" ]]; then
6576
# nightly: we set isSnapshot to true so artifacts are sent to the right repository on Maven Central.
6677
export ORG_GRADLE_PROJECT_isSnapshot="true"
67-
export HERMES_PREBUILT_FLAG="ORG_GRADLE_PROJECT_react.internal.useHermesNightly=true"
6878
TASKS="publishAllToMavenTempLocal publishAndroidToSonatype build"
6979
else
7080
# release: we want to build all archs (default)
71-
export HERMES_PREBUILT_FLAG="ORG_GRADLE_PROJECT_react.internal.useHermesStable=true"
7281
TASKS="publishAllToMavenTempLocal publishAndroidToSonatype build"
7382
fi
74-
env "$HERMES_PREBUILT_FLAG" ./gradlew $TASKS -PenableWarningsAsErrors=true
83+
./gradlew $TASKS -PenableWarningsAsErrors=true
7584
- name: Save Android ccache
7685
if: ${{ github.ref == 'refs/heads/main' || contains(github.ref, '-stable') }}
7786
uses: actions/cache/save@v5

0 commit comments

Comments
 (0)