@@ -25,12 +25,27 @@ jobs:
2525 steps :
2626 - name : Checkout
2727 uses : actions/checkout@v6
28+ - name : Set Hermes version
29+ shell : bash
30+ env :
31+ USE_HERMES_PREBUILT : ${{ inputs.use-hermes-prebuilt }}
32+ run : |
33+ if [ "$USE_HERMES_PREBUILT" == "true" ]; then
34+ HERMES_VERSION=$(curl --fail --silent --show-error --retry 3 https://registry.npmjs.org/hermes-compiler/latest-v1 | jq -er '.version')
35+ else
36+ HERMES_VERSION=$(sed -n 's/^HERMES_VERSION_NAME=//p' packages/react-native/sdks/hermes-engine/version.properties)
37+ fi
38+ test -n "$HERMES_VERSION"
39+ echo "HERMES_VERSION=$HERMES_VERSION" >> "$GITHUB_ENV"
2840 - name : Restore cache if present
2941 id : restore-ios-slice
42+ if : inputs.version-type == ''
3043 uses : actions/cache/restore@v5
3144 with :
32- key : v3-ios-core-${{ matrix.slice }}-${{ matrix.flavor }}-${{ hashFiles('packages/react-native/Package.swift', 'packages/react-native/scripts/ios-prebuild/*.js', 'packages/react-native/scripts/ios-prebuild.js', 'packages/react-native/React/**/*', 'packages/react-native/ReactCommon/**/*', 'packages/react-native/Libraries/**/*') }}
33- path : packages/react-native/
45+ key: v4-ios-core-${{ matrix.slice }}-${{ matrix.flavor }}-${{ hashFiles('.github/workflows/prebuild-ios-*.yml', '.github/actions/setup-*/action.yml', '.github/actions/yarn-install/action.yml', 'package.json', 'yarn.lock', 'babel.config.js', 'scripts/build/**/*', 'scripts/releases/ios-prebuild/**/*', 'scripts/releases/prepare-ios-prebuilds.js', 'packages/react-native/package.json', 'packages/react-native/Package.swift', 'packages/react-native/scripts/**/*', 'packages/react-native-codegen/**/*', 'packages/react-native/React/**/*', 'packages/react-native/ReactApple/**/*', 'packages/react-native/ReactCommon/**/*', 'packages/react-native/Libraries/**/*', 'packages/react-native/src/private/specs*/**/*', 'packages/react-native/src/**/Native*.js', 'packages/react-native/src/**/*NativeComponent.js', 'packages/react-native/third-party-podspecs/**/PrivacyInfo.xcprivacy', 'packages/react-native/sdks/hermes-engine/version.properties', '!packages/react-native/Libraries/**/*.js', '!packages/react-native/Libraries/**/*.js.flow', '!packages/react-native/Libraries/**/*.ts', '!packages/react-native/Libraries/**/*.tsx') }}-${{ env.HERMES_VERSION }}
46+ path : |
47+ packages/react-native/.build/output/spm/${{ matrix.flavor }}/Build/Products
48+ packages/react-native/.build/headers
3449 - name : Setup node.js
3550 if : steps.restore-ios-slice.outputs.cache-hit != 'true'
3651 uses : ./.github/actions/setup-node
4055 - name : Yarn Install
4156 if : steps.restore-ios-slice.outputs.cache-hit != 'true'
4257 uses : ./.github/actions/yarn-install
43- - name : Set Hermes version
44- shell : bash
45- run : |
46- # Non-stable RN builds resolve Hermes from npm's latest-v1 dist-tag.
47- # TODO: rename 'latest-v1' to 'latest' once V1 is the only Hermes on npm.
48- # Stable builds use the version pinned in version.properties.
49- if [ "${{ inputs.use-hermes-prebuilt }}" == "true" ]; then
50- HERMES_VERSION="latest-v1"
51- else
52- HERMES_VERSION=$(sed -n 's/^HERMES_VERSION_NAME=//p' packages/react-native/sdks/hermes-engine/version.properties)
53- fi
54- echo "Using Hermes version: $HERMES_VERSION"
55- echo "HERMES_VERSION=$HERMES_VERSION" >> $GITHUB_ENV
5658 - name : Set React Native version
5759 shell : bash
5860 run : |
@@ -108,9 +110,9 @@ jobs:
108110 packages/react-native/.build/output/spm/${{ matrix.flavor }}/Build/Products
109111 - name : Save Cache
110112 uses : actions/cache/save@v5
111- if : ${{ github.ref == 'refs/heads/main' }} # To avoid that the cache explode
113+ if : ${{ github.ref == 'refs/heads/main' && inputs.version-type == '' && steps.restore-ios-slice.outputs. cache-hit != 'true' }}
112114 with :
113- key : v3-ios-core- ${{ matrix.slice }}-${{ matrix.flavor }}-${{ hashFiles('packages/react-native/Package.swift', 'packages/react-native/scripts/ ios-prebuild/*.js', 'packages/react-native/scripts/ios-prebuild.js', 'packages/react-native/React/**/*', 'packages/react-native/ReactCommon/**/*', 'packages/react-native/Libraries/**/*') }}
115+ key : ${{ steps.restore- ios-slice.outputs.cache-primary-key }}
114116 path : |
115117 packages/react-native/.build/output/spm/${{ matrix.flavor }}/Build/Products
116118 packages/react-native/.build/headers
@@ -128,12 +130,28 @@ jobs:
128130 steps :
129131 - name : Checkout
130132 uses : actions/checkout@v6
133+ - name : Set Hermes version
134+ shell : bash
135+ env :
136+ USE_HERMES_PREBUILT : ${{ inputs.use-hermes-prebuilt }}
137+ run : |
138+ if [ "$USE_HERMES_PREBUILT" == "true" ]; then
139+ HERMES_VERSION=$(curl --fail --silent --show-error --retry 3 https://registry.npmjs.org/hermes-compiler/latest-v1 | jq -er '.version')
140+ else
141+ HERMES_VERSION=$(sed -n 's/^HERMES_VERSION_NAME=//p' packages/react-native/sdks/hermes-engine/version.properties)
142+ fi
143+ test -n "$HERMES_VERSION"
144+ echo "HERMES_VERSION=$HERMES_VERSION" >> "$GITHUB_ENV"
131145 - name : Restore cache if present
132146 id : restore-ios-xcframework
147+ if : inputs.version-type == ''
133148 uses : actions/cache/restore@v5
134149 with :
135- path : packages/react-native/.build/output/xcframeworks
136- key : v4-ios-core-xcframework-${{ matrix.flavor }}-${{ hashFiles('packages/react-native/Package.swift', 'packages/react-native/scripts/ios-prebuild/*.js', 'packages/react-native/scripts/ios-prebuild.js', 'packages/react-native/React/**/*', 'packages/react-native/ReactCommon/**/*', 'packages/react-native/Libraries/**/*') }}
150+ path : |
151+ packages/react-native/.build/output/xcframeworks/ReactCore${{matrix.flavor}}.xcframework.tar.gz
152+ packages/react-native/.build/output/xcframeworks/ReactCore${{matrix.flavor}}.framework.dSYM.tar.gz
153+ packages/react-native/.build/output/xcframeworks/ReactNativeHeaders${{matrix.flavor}}.xcframework.tar.gz
154+ key: v5-ios-core-xcframework-${{ matrix.flavor }}-${{ hashFiles('.github/workflows/prebuild-ios-*.yml', '.github/actions/setup-*/action.yml', '.github/actions/yarn-install/action.yml', 'package.json', 'yarn.lock', 'babel.config.js', 'scripts/build/**/*', 'scripts/releases/ios-prebuild/**/*', 'scripts/releases/prepare-ios-prebuilds.js', 'packages/react-native/package.json', 'packages/react-native/Package.swift', 'packages/react-native/scripts/**/*', 'packages/react-native-codegen/**/*', 'packages/react-native/React/**/*', 'packages/react-native/ReactApple/**/*', 'packages/react-native/ReactCommon/**/*', 'packages/react-native/Libraries/**/*', 'packages/react-native/src/private/specs*/**/*', 'packages/react-native/src/**/Native*.js', 'packages/react-native/src/**/*NativeComponent.js', 'packages/react-native/third-party-podspecs/**/PrivacyInfo.xcprivacy', 'packages/react-native/sdks/hermes-engine/version.properties', '!packages/react-native/Libraries/**/*.js', '!packages/react-native/Libraries/**/*.js.flow', '!packages/react-native/Libraries/**/*.ts', '!packages/react-native/Libraries/**/*.tsx') }}-${{ env.HERMES_VERSION }}
137155 - name : Setup node.js
138156 if : steps.restore-ios-xcframework.outputs.cache-hit != 'true'
139157 uses : ./.github/actions/setup-node
@@ -175,20 +193,6 @@ jobs:
175193 tar -xzf /tmp/third-party/ReactNativeDependencies${{ matrix.flavor }}.xcframework.tar.gz -C /tmp/third-party/
176194 mkdir -p packages/react-native/third-party/
177195 mv /tmp/third-party/packages/react-native/third-party/ReactNativeDependencies.xcframework packages/react-native/third-party/ReactNativeDependencies.xcframework
178- - name : Set Hermes version
179- if : steps.restore-ios-xcframework.outputs.cache-hit != 'true'
180- shell : bash
181- run : |
182- # Non-stable RN builds resolve Hermes from npm's latest-v1 dist-tag.
183- # TODO: rename 'latest-v1' to 'latest' once V1 is the only Hermes on npm.
184- # Stable builds use the version pinned in version.properties.
185- if [ "${{ inputs.use-hermes-prebuilt }}" == "true" ]; then
186- HERMES_VERSION="latest-v1"
187- else
188- HERMES_VERSION=$(sed -n 's/^HERMES_VERSION_NAME=//p' packages/react-native/sdks/hermes-engine/version.properties)
189- fi
190- echo "Using Hermes version: $HERMES_VERSION"
191- echo "HERMES_VERSION=$HERMES_VERSION" >> $GITHUB_ENV
192196 - name : Stage Hermes headers
193197 if : steps.restore-ios-xcframework.outputs.cache-hit != 'true'
194198 working-directory : packages/react-native
@@ -260,11 +264,11 @@ jobs:
260264 name : ReactNativeHeaders${{ matrix.flavor }}.xcframework.tar.gz
261265 path : packages/react-native/.build/output/xcframeworks/ReactNativeHeaders${{matrix.flavor}}.xcframework.tar.gz
262266 - name : Save cache if present
263- if : ${{ github.ref == 'refs/heads/main' }} # To avoid that the cache explode
267+ if : ${{ github.ref == 'refs/heads/main' && inputs.version-type == '' && steps.restore-ios-xcframework.outputs. cache-hit != 'true' }}
264268 uses : actions/cache/save@v5
265269 with :
266270 path : |
267271 packages/react-native/.build/output/xcframeworks/ReactCore${{matrix.flavor}}.xcframework.tar.gz
268272 packages/react-native/.build/output/xcframeworks/ReactCore${{matrix.flavor}}.framework.dSYM.tar.gz
269273 packages/react-native/.build/output/xcframeworks/ReactNativeHeaders${{matrix.flavor}}.xcframework.tar.gz
270- key : v4-ios-core-xcframework- ${{ matrix.flavor }}-${{ hashFiles('packages/react-native/Package.swift', 'packages/react-native/scripts/ ios-prebuild/*.js', 'packages/react-native/scripts/ios-prebuild.js', 'packages/react-native/React/**/*', 'packages/react-native/ReactCommon/**/*', 'packages/react-native/Libraries/**/*') }}
274+ key : ${{ steps.restore- ios-xcframework.outputs.cache-primary-key }}
0 commit comments