1- name : NPM Trusted Release (iOS engines)
1+ name : NPM Trusted Release
22
3- # Publishes one or more engine-specific NativeScript iOS runtime packages
3+ # Publishes one or more NativeScript iOS npm packages
44# (@nativescript/ios-v8, @nativescript/ios-hermes, @nativescript/ios-jsc,
5- # @nativescript/ios-quickjs) via npm trusted publishing (OIDC).
5+ # @nativescript/ios-quickjs, @nativescript/react-native) via npm trusted
6+ # publishing (OIDC).
67#
78# Each package must be configured on npmjs.com with a trusted publisher that
89# points at this repository + workflow + environment. With `engine: all`, the
9- # workflow fans out across all four engines via a matrix.
10+ # workflow fans out across the four iOS engine packages via a matrix; use
11+ # `engine: react-native` to publish @nativescript/react-native.
1012
1113on :
1214 workflow_dispatch :
1315 inputs :
1416 engine :
15- description : " Engine to release (or 'all' to publish every engine)"
17+ description : " Package to release (engine package, react-native, or 'all' for every iOS engine)"
1618 required : true
1719 type : choice
1820 default : v8
2123 - hermes
2224 - jsc
2325 - quickjs
26+ - react-native
2427 - all
2528 release-type :
2629 description : " Version bump (patch/minor/major publish to 'latest'; prerelease uses 'preid' as the dist-tag)"
4447 default : true
4548
4649concurrency :
47- # Avoid overlapping publishes on the same ref/engine selection.
50+ # Avoid overlapping publishes on the same ref/package selection.
4851 group : npm-trusted-release-${{ github.ref }}-${{ inputs.engine }}
4952 cancel-in-progress : false
5053
5356
5457jobs :
5558 matrix :
56- name : Resolve engine matrix
59+ name : Resolve package matrix
5760 runs-on : ubuntu-latest
5861 outputs :
59- engines : ${{ steps.compute.outputs.engines }}
62+ targets : ${{ steps.compute.outputs.targets }}
6063 steps :
6164 - name : Compute matrix
6265 id : compute
6366 run : |
6467 if [ "${{ inputs.engine }}" = "all" ]; then
65- echo 'engines =["v8","hermes","jsc","quickjs"]' >> "$GITHUB_OUTPUT"
68+ echo 'targets =["v8","hermes","jsc","quickjs"]' >> "$GITHUB_OUTPUT"
6669 else
67- echo "engines =[\"${{ inputs.engine }}\"]" >> "$GITHUB_OUTPUT"
70+ echo "targets =[\"${{ inputs.engine }}\"]" >> "$GITHUB_OUTPUT"
6871 fi
6972
7073 build :
71- name : Build ${{ matrix.engine }}
74+ name : Build ${{ matrix.target }}
7275 needs : matrix
7376 runs-on : macos-26
7477 strategy :
7578 fail-fast : false
7679 matrix :
77- engine : ${{ fromJson(needs.matrix.outputs.engines ) }}
80+ target : ${{ fromJson(needs.matrix.outputs.targets ) }}
7881 outputs :
79- # Per-engine outputs aren't natively supported with matrices, so each job
82+ # Per-target outputs aren't natively supported with matrices, so each job
8083 # uploads its computed metadata alongside the tarball artifact.
8184 placeholder : noop
82- env :
83- IOS_VARIANT : ios-${{ matrix.engine }}
8485 steps :
8586 - name : Harden the runner (Audit all outbound calls)
8687 uses : step-security/harden-runner@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2
@@ -122,7 +123,19 @@ jobs:
122123 set -euo pipefail
123124 release_type='${{ inputs.release-type }}'
124125 preid='${{ inputs.preid }}'
125- pkg_dir="packages/${IOS_VARIANT}"
126+ target='${{ matrix.target }}'
127+ if [ "$target" = "react-native" ]; then
128+ pkg_dir="packages/react-native"
129+ package_name="@nativescript/react-native"
130+ tarball_basename="nativescript-react-native"
131+ npm_tag_target="react-native"
132+ else
133+ pkg_dir="packages/ios-${target}"
134+ package_name="@nativescript/ios-${target}"
135+ tarball_basename="nativescript-ios-${target}"
136+ npm_tag_target="ios-${target}"
137+ echo "IOS_VARIANT=ios-${target}" >> "$GITHUB_ENV"
138+ fi
126139
127140 pushd "$pkg_dir" >/dev/null
128141 if [ "$release_type" = "prerelease" ]; then
@@ -133,40 +146,54 @@ jobs:
133146 NPM_VERSION=$(node -e "console.log(require('./package.json').version)")
134147 popd >/dev/null
135148
136- NPM_TAG=$(NPM_VERSION="$NPM_VERSION" node ./scripts/get-npm-tag.js "$IOS_VARIANT ")
149+ NPM_TAG=$(NPM_VERSION="$NPM_VERSION" node ./scripts/get-npm-tag.js "$npm_tag_target ")
137150 echo "NPM_VERSION=$NPM_VERSION" >> "$GITHUB_OUTPUT"
138151 echo "NPM_TAG=$NPM_TAG" >> "$GITHUB_OUTPUT"
139- echo "Resolved $IOS_VARIANT@$NPM_VERSION (tag: $NPM_TAG)"
140- - name : Build (--${{ matrix.engine }})
141- run : ./scripts/build_all_ios.sh --${{ matrix.engine }}
152+ echo "PACKAGE_DIR=$pkg_dir" >> "$GITHUB_OUTPUT"
153+ echo "PACKAGE_NAME=$package_name" >> "$GITHUB_OUTPUT"
154+ echo "TARBALL_BASENAME=$tarball_basename" >> "$GITHUB_OUTPUT"
155+ echo "Resolved $package_name@$NPM_VERSION (tag: $NPM_TAG)"
156+ - name : Build iOS engine (--${{ matrix.target }})
157+ if : ${{ matrix.target != 'react-native' }}
158+ run : ./scripts/build_all_ios.sh --${{ matrix.target }}
159+ - name : Build @nativescript/react-native
160+ if : ${{ matrix.target == 'react-native' }}
161+ run : |
162+ ./scripts/build_all_react_native.sh
163+ ./scripts/build_react_native_turbomodule.sh
142164 - name : Record metadata
143165 shell : bash
144166 run : |
145- mkdir -p packages/${IOS_VARIANT}/dist
146- cat > packages/${IOS_VARIANT}/dist/release-meta.json <<EOF
167+ set -euo pipefail
168+ package_dir="${{ steps.bump.outputs.PACKAGE_DIR }}"
169+ tarball_file="${{ steps.bump.outputs.TARBALL_BASENAME }}-${{ steps.bump.outputs.NPM_VERSION }}.tgz"
170+ mkdir -p "$package_dir/dist"
171+ cat > "$package_dir/dist/release-meta.json" <<EOF
147172 {
148- "engine ": "${{ matrix.engine }}",
149- "variant ": "${IOS_VARIANT} ",
150- "package_name": "@nativescript/ios- ${{ matrix.engine }}",
173+ "target ": "${{ matrix.target }}",
174+ "package_dir ": "$package_dir ",
175+ "package_name": "${{ steps.bump.outputs.PACKAGE_NAME }}",
151176 "version": "${{ steps.bump.outputs.NPM_VERSION }}",
152- "tag": "${{ steps.bump.outputs.NPM_TAG }}"
177+ "tag": "${{ steps.bump.outputs.NPM_TAG }}",
178+ "tarball": "$tarball_file"
153179 }
154180 EOF
155181 - name : Upload npm package artifact
156182 uses : actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
157183 with :
158- name : npm-package-${{ matrix.engine }}
184+ name : npm-package-${{ matrix.target }}
159185 path : |
160- packages/ios- ${{ matrix.engine }}/dist/nativescript-ios- ${{ matrix.engine }}-${{ steps.bump.outputs.NPM_VERSION }}.tgz
161- packages/ios- ${{ matrix.engine }}/dist/release-meta.json
186+ ${{ steps.bump.outputs.PACKAGE_DIR }}/dist/${{ steps.bump.outputs.TARBALL_BASENAME }}-${{ steps.bump.outputs.NPM_VERSION }}.tgz
187+ ${{ steps.bump.outputs.PACKAGE_DIR }}/dist/release-meta.json
162188 - name : Upload dSYMs artifact
189+ if : ${{ matrix.target != 'react-native' }}
163190 uses : actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
164191 with :
165- name : NativeScript-dSYMs-${{ matrix.engine }}
192+ name : NativeScript-dSYMs-${{ matrix.target }}
166193 path : dist/dSYMs
167194
168195 publish :
169- name : Publish ${{ matrix.engine }}
196+ name : Publish ${{ matrix.target }}
170197 needs :
171198 - matrix
172199 - build
@@ -176,7 +203,7 @@ jobs:
176203 strategy :
177204 fail-fast : false
178205 matrix :
179- engine : ${{ fromJson(needs.matrix.outputs.engines ) }}
206+ target : ${{ fromJson(needs.matrix.outputs.targets ) }}
180207 permissions :
181208 contents : read
182209 id-token : write
@@ -191,8 +218,8 @@ jobs:
191218 registry-url : " https://registry.npmjs.org"
192219 - uses : actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0
193220 with :
194- name : npm-package-${{ matrix.engine }}
195- path : packages/ios- ${{ matrix.engine }}/dist
221+ name : npm-package-${{ matrix.target }}
222+ path : npm-package/ ${{ matrix.target }}
196223 - name : Update npm (required for OIDC trusted publishing)
197224 run : |
198225 corepack enable npm
@@ -204,30 +231,33 @@ jobs:
204231 shell : bash
205232 run : |
206233 set -euo pipefail
207- meta="packages/ios- ${{ matrix.engine }}/dist /release-meta.json"
234+ meta="npm-package/ ${{ matrix.target }}/release-meta.json"
208235 if [ ! -f "$meta" ]; then
209236 echo "Missing release metadata at $meta" >&2
210237 exit 1
211238 fi
212239 NPM_VERSION=$(node -e "console.log(require('./$meta').version)")
213240 NPM_TAG=$(node -e "console.log(require('./$meta').tag)")
214241 PACKAGE_NAME=$(node -e "console.log(require('./$meta').package_name)")
242+ TARBALL=$(node -e "console.log(require('./$meta').tarball)")
215243 echo "NPM_VERSION=$NPM_VERSION" >> "$GITHUB_OUTPUT"
216244 echo "NPM_TAG=$NPM_TAG" >> "$GITHUB_OUTPUT"
217245 echo "PACKAGE_NAME=$PACKAGE_NAME" >> "$GITHUB_OUTPUT"
246+ echo "TARBALL=$TARBALL" >> "$GITHUB_OUTPUT"
218247 - name : Publish package (OIDC trusted publishing)
219248 if : ${{ vars.USE_NPM_TOKEN != 'true' }}
220249 shell : bash
221250 env :
222251 NPM_VERSION : ${{ steps.meta.outputs.NPM_VERSION }}
223252 NPM_TAG : ${{ steps.meta.outputs.NPM_TAG }}
224253 PACKAGE_NAME : ${{ steps.meta.outputs.PACKAGE_NAME }}
254+ TARBALL : ${{ steps.meta.outputs.TARBALL }}
225255 DRY_RUN : ${{ inputs.dry-run }}
226256 NODE_AUTH_TOKEN : " "
227257 run : |
228258 set -euo pipefail
229- TARBALL="packages/ios- ${{ matrix.engine }}/dist/nativescript-ios-${{ matrix.engine }}-${NPM_VERSION}.tgz "
230- PUBLISH_ARGS=("$TARBALL " --tag "$NPM_TAG" --access public --provenance)
259+ TARBALL_PATH="npm-package/ ${{ matrix.target }}/${TARBALL} "
260+ PUBLISH_ARGS=("$TARBALL_PATH " --tag "$NPM_TAG" --access public --provenance)
231261 if [ "$DRY_RUN" = "true" ]; then
232262 PUBLISH_ARGS+=(--dry-run)
233263 fi
@@ -245,12 +275,13 @@ jobs:
245275 NPM_VERSION : ${{ steps.meta.outputs.NPM_VERSION }}
246276 NPM_TAG : ${{ steps.meta.outputs.NPM_TAG }}
247277 PACKAGE_NAME : ${{ steps.meta.outputs.PACKAGE_NAME }}
278+ TARBALL : ${{ steps.meta.outputs.TARBALL }}
248279 DRY_RUN : ${{ inputs.dry-run }}
249280 NODE_AUTH_TOKEN : ${{ secrets.NPM_PUBLISH_TOKEN }}
250281 run : |
251282 set -euo pipefail
252- TARBALL="packages/ios- ${{ matrix.engine }}/dist/nativescript-ios-${{ matrix.engine }}-${NPM_VERSION}.tgz "
253- PUBLISH_ARGS=("$TARBALL " --tag "$NPM_TAG" --access public --provenance)
283+ TARBALL_PATH="npm-package/ ${{ matrix.target }}/${TARBALL} "
284+ PUBLISH_ARGS=("$TARBALL_PATH " --tag "$NPM_TAG" --access public --provenance)
254285 if [ "$DRY_RUN" = "true" ]; then
255286 PUBLISH_ARGS+=(--dry-run)
256287 fi
@@ -268,10 +299,10 @@ jobs:
268299 steps :
269300 - name : Print summary
270301 run : |
271- echo "Engine selection: ${{ inputs.engine }}"
302+ echo "Package selection: ${{ inputs.engine }}"
272303 echo "Release type: ${{ inputs.release-type }}"
273304 echo "Preid: ${{ inputs.preid }}"
274305 echo "Dry run: ${{ inputs.dry-run }}"
275- echo "Engines : ${{ needs.matrix.outputs.engines }}"
306+ echo "Targets : ${{ needs.matrix.outputs.targets }}"
276307 echo "Build result: ${{ needs.build.result }}"
277308 echo "Publish result: ${{ needs.publish.result }}"
0 commit comments