Skip to content

Commit 623197d

Browse files
committed
ci: release ios napi v8 package
1 parent e75407f commit 623197d

3 files changed

Lines changed: 36 additions & 95 deletions

File tree

.github/workflows/npm_napi_release.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
name: NPM Node-API Release
22
on:
3-
push:
4-
branches:
5-
- main
6-
tags:
7-
- "v*"
3+
workflow_dispatch:
84

95
env:
106
XCODE_VERSION: "26.2.0"

.github/workflows/npm_release.yml

Lines changed: 34 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,24 @@
1-
name: NPM Release iOS & macOS
1+
name: NPM Release iOS
22
on:
33
push:
4-
branches:
5-
- main
64
tags:
75
- "v*"
6+
workflow_dispatch:
7+
inputs:
8+
dry_run:
9+
description: "Run npm publish with --dry-run"
10+
required: true
11+
type: boolean
12+
default: true
813

914
env:
10-
NPM_TAG: "next"
11-
XCODE_VERSION: "^15.0"
15+
EXPECTED_NPM_TAG: "napi-v8"
16+
XCODE_VERSION: "26.2.0"
1217

1318
jobs:
1419
build:
1520
name: Build
16-
runs-on: macos-14
21+
runs-on: macos-26
1722
outputs:
1823
npm_version: ${{ steps.npm_version_output.outputs.NPM_VERSION }}
1924
npm_tag: ${{ steps.npm_version_output.outputs.NPM_TAG }}
@@ -28,9 +33,10 @@ jobs:
2833
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
2934
with:
3035
fetch-depth: 0
36+
submodules: recursive
3137
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
3238
with:
33-
node-version: 22
39+
node-version: 24
3440
registry-url: "https://registry.npmjs.org"
3541
- name: Install Python
3642
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
@@ -57,17 +63,11 @@ jobs:
5763
run: |
5864
NPM_VERSION=$(node -e "console.log(require('./packages/ios/package.json').version);")
5965
echo NPM_VERSION=$NPM_VERSION >> $GITHUB_ENV
60-
- name: Bump version for dev release
61-
if: ${{ !contains(github.ref, 'refs/tags/') }}
62-
run: |
63-
NPM_VERSION=$(node ./scripts/get-next-version.js ios)
64-
echo NPM_VERSION=$NPM_VERSION >> $GITHUB_ENV
65-
cd packages/ios
66-
npm version $NPM_VERSION --no-git-tag-version
6766
- name: Output NPM Version and tag
6867
id: npm_version_output
6968
run: |
7069
NPM_TAG=$(node ./scripts/get-npm-tag.js ios)
70+
test "$NPM_TAG" = "$EXPECTED_NPM_TAG"
7171
echo NPM_VERSION=$NPM_VERSION >> $GITHUB_OUTPUT
7272
echo NPM_TAG=$NPM_TAG >> $GITHUB_OUTPUT
7373
- name: Build
@@ -82,78 +82,12 @@ jobs:
8282
with:
8383
name: NativeScript-dSYMs
8484
path: dist/dSYMs
85-
test:
86-
name: Test
87-
runs-on: macos-14
88-
needs: build
89-
steps:
90-
- name: Harden the runner (Audit all outbound calls)
91-
uses: step-security/harden-runner@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2
92-
with:
93-
egress-policy: audit
94-
- uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd # v1.6.0
95-
with:
96-
xcode-version: ${{env.XCODE_VERSION}}
97-
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
98-
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
99-
with:
100-
node-version: 22
101-
- name: Install Python
102-
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
103-
with:
104-
python-version: "3"
105-
- name: Install Dependencies
106-
run: |
107-
npm install
108-
python3 -m pip install --upgrade pip six
109-
# Ensure LLVM linker used by -fuse-ld=lld is available
110-
if ! command -v ld64.lld >/dev/null; then
111-
brew list lld || brew install lld
112-
fi
113-
# Ensure CMake is available without conflicting with pinned Homebrew formula
114-
if ! command -v cmake >/dev/null; then
115-
brew list cmake || brew install cmake
116-
fi
117-
# Some scripts expect cmake at /usr/local/bin; create a shim if needed
118-
if [ ! -x /usr/local/bin/cmake ]; then
119-
sudo mkdir -p /usr/local/bin
120-
sudo ln -sf "$(command -v cmake)" /usr/local/bin/cmake
121-
fi
122-
brew install chargepoint/xcparse/xcparse
123-
npm install -g @edusperoni/junit-cli-report-viewer verify-junit-xml
124-
- name: Prepare
125-
run: npm run setup-ci
126-
- name: Prepare test folder
127-
run: |
128-
mkdir -p dist-test
129-
echo TEST_FOLDER=$(pwd)/dist-test >> $GITHUB_ENV
130-
- name: Xcode Tests
131-
uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3.0.2
132-
# try to run the tests with xcpretty. If it fails then try again without xcpretty twice for better log output
133-
# the xcode tests are a bit flaky and they should never fail on this step, as this step only collects the JS test results as junit xml
134-
with:
135-
timeout_minutes: 20
136-
max_attempts: 2
137-
command: set -o pipefail && xcodebuild -project v8ios.xcodeproj -scheme TestRunner -resultBundlePath $TEST_FOLDER/test_results -destination platform\=iOS\ Simulator,OS\=17.2,name\=iPhone\ 15\ Pro\ Max build test | xcpretty
138-
on_retry_command: rm -rf $TEST_FOLDER/test_results* && xcrun simctl shutdown all
139-
new_command_on_retry: xcodebuild -project v8ios.xcodeproj -scheme TestRunner -resultBundlePath $TEST_FOLDER/test_results -destination platform\=iOS\ Simulator,OS\=17.2,name\=iPhone\ 15\ Pro\ Max build test
140-
- name: Validate Test Results
141-
run: |
142-
xcparse attachments $TEST_FOLDER/test_results.xcresult $TEST_FOLDER/test-out
143-
find $TEST_FOLDER/test-out -name "*junit*.xml" -maxdepth 1 -print0 | xargs -n 1 -0 npx junit-cli-report-viewer
144-
find $TEST_FOLDER/test-out -name "*junit*.xml" -maxdepth 1 -print0 | xargs -n 1 -0 npx verify-junit-xml
145-
- name: Archive Test Result Data
146-
if: always()
147-
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
148-
with:
149-
name: test-results
150-
path: ${{env.TEST_FOLDER}}/test_results.xcresult
15185
publish:
86+
if: ${{ startsWith(github.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch' }}
15287
runs-on: ubuntu-latest
15388
environment: npm-publish
15489
needs:
15590
- build
156-
- test
15791
permissions:
15892
contents: read
15993
id-token: write
@@ -167,34 +101,46 @@ jobs:
167101
egress-policy: audit
168102
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
169103
with:
170-
node-version: 22
104+
node-version: 24
171105
registry-url: "https://registry.npmjs.org"
172106
- uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0
173107
with:
174108
name: npm-package
175109
path: packages/ios/dist
176110
- name: Update npm (required for OIDC trusted publishing)
177111
run: |
178-
npm install -g npm@^11.5.1
179-
npm --version
112+
corepack enable npm
113+
corepack install -g npm@11.6.2
114+
test "$(npm --version)" = "11.6.2"
115+
test "$(npx --version)" = "11.6.2"
180116
- name: Publish package (OIDC trusted publishing)
181117
if: ${{ vars.USE_NPM_TOKEN != 'true' }}
182118
run: |
119+
PUBLISH_ARGS=(./packages/ios/dist/nativescript-ios-${NPM_VERSION}.tgz --tag "$NPM_TAG" --access public --provenance)
120+
if [ "$DRY_RUN" = "true" ]; then
121+
PUBLISH_ARGS+=(--dry-run)
122+
fi
183123
echo "Publishing @nativescript/ios@$NPM_VERSION to NPM with tag $NPM_TAG via OIDC trusted publishing..."
184124
unset NODE_AUTH_TOKEN
185125
if [ -n "${NPM_CONFIG_USERCONFIG:-}" ]; then
186126
rm -f "$NPM_CONFIG_USERCONFIG"
187127
fi
188-
npm publish ./packages/ios/dist/nativescript-ios-${{env.NPM_VERSION}}.tgz --tag $NPM_TAG --access public --provenance
128+
npm publish "${PUBLISH_ARGS[@]}"
189129
env:
130+
DRY_RUN: ${{ github.event_name == 'workflow_dispatch' && inputs.dry_run }}
190131
NODE_AUTH_TOKEN: ""
191132

192133
- name: Publish package (granular token)
193134
if: ${{ vars.USE_NPM_TOKEN == 'true' }}
194135
run: |
136+
PUBLISH_ARGS=(./packages/ios/dist/nativescript-ios-${NPM_VERSION}.tgz --tag "$NPM_TAG" --access public --provenance)
137+
if [ "$DRY_RUN" = "true" ]; then
138+
PUBLISH_ARGS+=(--dry-run)
139+
fi
195140
echo "Publishing @nativescript/ios@$NPM_VERSION to NPM with tag $NPM_TAG via granular token..."
196-
npm publish ./packages/ios/dist/nativescript-ios-${{env.NPM_VERSION}}.tgz --tag $NPM_TAG --access public --provenance
141+
npm publish "${PUBLISH_ARGS[@]}"
197142
env:
143+
DRY_RUN: ${{ github.event_name == 'workflow_dispatch' && inputs.dry_run }}
198144
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
199145
github-release:
200146
runs-on: ubuntu-latest
@@ -204,7 +150,6 @@ jobs:
204150
contents: write
205151
needs:
206152
- build
207-
- test
208153
env:
209154
NPM_VERSION: ${{needs.build.outputs.npm_version}}
210155
steps:
@@ -217,7 +162,7 @@ jobs:
217162
fetch-depth: 0
218163
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
219164
with:
220-
node-version: 22
165+
node-version: 24
221166
- name: Setup
222167
run: npm install
223168
- uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0
@@ -235,7 +180,7 @@ jobs:
235180
run: npx conventional-changelog -p angular -r2 > body.md
236181
- uses: ncipollo/release-action@b7eabc95ff50cbeeedec83973935c8f306dfcd0b # v1.20.0
237182
with:
238-
artifacts: "packages/ios/dist/nativescript-ios-*.tgz,dist/dSYMs/*.zip"
183+
artifacts: "dist/nativescript-ios-*.tgz,dist/dSYMs/*.zip"
239184
bodyFile: "body.md"
240185
prerelease: ${{needs.build.outputs.npm_tag != 'latest'}}
241186
allowUpdates: true

packages/ios/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@nativescript/ios",
3-
"version": "9.0.0-napi-v8.0",
3+
"version": "9.0.0-napi-v8.1",
44
"description": "NativeScript Runtime for iOS",
55
"keywords": [
66
"NativeScript",

0 commit comments

Comments
 (0)