@@ -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 : |
@@ -111,9 +113,9 @@ jobs:
111113 path : ${{ runner.temp }}/prebuild-ios-core-slice-${{ matrix.flavor }}-${{ matrix.slice }}.tar.gz
112114 - name : Save Cache
113115 uses : actions/cache/save@v5
114- if : ${{ github.ref == 'refs/heads/main' }} # To avoid that the cache explode
116+ if : ${{ github.ref == 'refs/heads/main' && inputs.version-type == '' && steps.restore-ios-slice.outputs. cache-hit != 'true' }}
115117 with :
116- 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/**/*') }}
118+ key : ${{ steps.restore- ios-slice.outputs.cache-primary-key }}
117119 path : |
118120 packages/react-native/.build/output/spm/${{ matrix.flavor }}/Build/Products
119121 packages/react-native/.build/headers
@@ -131,12 +133,28 @@ jobs:
131133 steps :
132134 - name : Checkout
133135 uses : actions/checkout@v6
136+ - name : Set Hermes version
137+ shell : bash
138+ env :
139+ USE_HERMES_PREBUILT : ${{ inputs.use-hermes-prebuilt }}
140+ run : |
141+ if [ "$USE_HERMES_PREBUILT" == "true" ]; then
142+ HERMES_VERSION=$(curl --fail --silent --show-error --retry 3 https://registry.npmjs.org/hermes-compiler/latest-v1 | jq -er '.version')
143+ else
144+ HERMES_VERSION=$(sed -n 's/^HERMES_VERSION_NAME=//p' packages/react-native/sdks/hermes-engine/version.properties)
145+ fi
146+ test -n "$HERMES_VERSION"
147+ echo "HERMES_VERSION=$HERMES_VERSION" >> "$GITHUB_ENV"
134148 - name : Restore cache if present
135149 id : restore-ios-xcframework
150+ if : inputs.version-type == ''
136151 uses : actions/cache/restore@v5
137152 with :
138- path : packages/react-native/.build/output/xcframeworks
139- key : v5-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/**/*') }}
153+ path : |
154+ packages/react-native/.build/output/xcframeworks/ReactCore${{matrix.flavor}}.xcframework.tar.gz
155+ packages/react-native/.build/output/xcframeworks/ReactCore${{matrix.flavor}}.framework.dSYM.tar.gz
156+ packages/react-native/.build/output/xcframeworks/ReactNativeHeaders${{matrix.flavor}}.xcframework.tar.gz
157+ 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 }}
140158 - name : Setup node.js
141159 if : steps.restore-ios-xcframework.outputs.cache-hit != 'true'
142160 uses : ./.github/actions/setup-node
@@ -185,20 +203,6 @@ jobs:
185203 tar -xzf /tmp/third-party/ReactNativeDependencies${{ matrix.flavor }}.xcframework.tar.gz -C /tmp/third-party/
186204 mkdir -p packages/react-native/third-party/
187205 mv /tmp/third-party/packages/react-native/third-party/ReactNativeDependencies.xcframework packages/react-native/third-party/ReactNativeDependencies.xcframework
188- - name : Set Hermes version
189- if : steps.restore-ios-xcframework.outputs.cache-hit != 'true'
190- shell : bash
191- run : |
192- # Non-stable RN builds resolve Hermes from npm's latest-v1 dist-tag.
193- # TODO: rename 'latest-v1' to 'latest' once V1 is the only Hermes on npm.
194- # Stable builds use the version pinned in version.properties.
195- if [ "${{ inputs.use-hermes-prebuilt }}" == "true" ]; then
196- HERMES_VERSION="latest-v1"
197- else
198- HERMES_VERSION=$(sed -n 's/^HERMES_VERSION_NAME=//p' packages/react-native/sdks/hermes-engine/version.properties)
199- fi
200- echo "Using Hermes version: $HERMES_VERSION"
201- echo "HERMES_VERSION=$HERMES_VERSION" >> $GITHUB_ENV
202206 - name : Stage Hermes headers
203207 if : steps.restore-ios-xcframework.outputs.cache-hit != 'true'
204208 working-directory : packages/react-native
@@ -232,16 +236,6 @@ jobs:
232236 # regressions here instead of in downstream builds.
233237 cd packages/react-native
234238 node scripts/ios-prebuild/headers-verify.js --flavor "${{ matrix.flavor }}" ${{ inputs.version-type != '' && '--require-stamped-version' || '' }}
235- - name : Verify Mac Catalyst framework symlinks
236- if : steps.restore-ios-xcframework.outputs.cache-hit != 'true'
237- run : |
238- framework="packages/react-native/.build/output/xcframeworks/${{ matrix.flavor }}/React.xcframework/ios-arm64_x86_64-maccatalyst/React.framework"
239- for link in React Resources Versions/Current; do
240- if [ ! -L "$framework/$link" ]; then
241- echo "::error::Expected framework symlink: $framework/$link. Archive build slices before uploading them."
242- exit 1
243- fi
244- done
245239 - name : Compress and Rename XCFramework
246240 if : steps.restore-ios-xcframework.outputs.cache-hit != 'true'
247241 run : |
@@ -280,11 +274,11 @@ jobs:
280274 name : ReactNativeHeaders${{ matrix.flavor }}.xcframework.tar.gz
281275 path : packages/react-native/.build/output/xcframeworks/ReactNativeHeaders${{matrix.flavor}}.xcframework.tar.gz
282276 - name : Save cache if present
283- if : ${{ github.ref == 'refs/heads/main' }} # To avoid that the cache explode
277+ if : ${{ github.ref == 'refs/heads/main' && inputs.version-type == '' && steps.restore-ios-xcframework.outputs. cache-hit != 'true' }}
284278 uses : actions/cache/save@v5
285279 with :
286280 path : |
287281 packages/react-native/.build/output/xcframeworks/ReactCore${{matrix.flavor}}.xcframework.tar.gz
288282 packages/react-native/.build/output/xcframeworks/ReactCore${{matrix.flavor}}.framework.dSYM.tar.gz
289283 packages/react-native/.build/output/xcframeworks/ReactNativeHeaders${{matrix.flavor}}.xcframework.tar.gz
290- key : v5-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/**/*') }}
284+ key : ${{ steps.restore- ios-xcframework.outputs.cache-primary-key }}
0 commit comments