Skip to content

Commit be315d3

Browse files
committed
ci: workflow
1 parent f6caccb commit be315d3

1 file changed

Lines changed: 32 additions & 8 deletions

File tree

.github/workflows/npm_release.yml

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,12 @@
33
# FontManager.xcframework release.
44
#
55
# Triggered automatically at the end of the SPM Release workflow, or manually
6-
# via workflow_dispatch. Requires an NPM_TOKEN secret with publish rights to
7-
# @nativescript/font-manager.
6+
# via workflow_dispatch.
7+
#
8+
# Authentication uses npm Trusted Publishing (OIDC) — no NPM_TOKEN required.
9+
# The `id-token: write` permission below lets the npm CLI (>= 11.5.1) exchange a
10+
# short-lived GitHub OIDC token for publish rights. The Trusted Publisher must be
11+
# configured on npmjs.com for this repo + workflow file (npm_release.yml).
812
name: npm Release
913

1014
on:
@@ -17,7 +21,7 @@ on:
1721

1822
permissions:
1923
contents: read
20-
id-token: write # npm provenance
24+
id-token: write # required for npm Trusted Publishing (OIDC) + provenance
2125

2226
concurrency:
2327
group: npm-release
@@ -52,14 +56,34 @@ jobs:
5256
node-version: 22
5357
registry-url: 'https://registry.npmjs.org'
5458

59+
# Node 22 ships npm ~10.x; Trusted Publishing requires npm >= 11.5.1.
60+
- name: Upgrade npm for Trusted Publishing
61+
run: npm install -g npm@latest
62+
5563
- name: Install dependencies
5664
run: npm ci
5765

58-
- name: Build and publish @nativescript/font-manager
59-
env:
60-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
61-
NPM_CONFIG_PROVENANCE: true
62-
run: npx nx g @nativescript/plugin-tools:publish font-manager --version="${{ steps.version.outputs.version }}" --verify --no-interactive
66+
- name: Verify package.json matches release version
67+
run: |
68+
VERSION="${{ steps.version.outputs.version }}"
69+
PKG_VERSION="$(node -p "require('./packages/font-manager/package.json').version")"
70+
if [ "$PKG_VERSION" != "$VERSION" ]; then
71+
echo "error: packages/font-manager/package.json is $PKG_VERSION but expected $VERSION" >&2
72+
exit 1
73+
fi
74+
75+
# build.all runs tools/scripts/build-finish.ts, which produces a
76+
# ready-to-publish dist/packages/font-manager (cleaned package.json,
77+
# publishing assets copied in).
78+
- name: Build @nativescript/font-manager
79+
run: npx nx run font-manager:build.all
80+
81+
# Publish the exact version from the release tag. No token env is set —
82+
# the npm CLI authenticates via OIDC (Trusted Publishing) and generates
83+
# provenance automatically.
84+
- name: Publish @nativescript/font-manager
85+
working-directory: dist/packages/font-manager
86+
run: npm publish --access public --provenance
6387

6488
- name: Verify npm publish
6589
run: |

0 commit comments

Comments
 (0)