Skip to content

Commit c921212

Browse files
committed
ci: switch release workflow to npm Trusted Publishing (OIDC)
Security enabled a Trusted Publisher for this repo + release.yml, so publish keylessly via GitHub OIDC instead of the NPM_PUBLISH_TOKEN secret. Adds id-token: write, drops the token, upgrades npm to a Trusted-Publishing-capable version.
1 parent bf595e6 commit c921212

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

.github/workflows/release.yml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
name: Release
22

3-
# Publishes @phantom/react-native-fast-image to public npm. The @phantom scope is
4-
# public on npmjs.org (the wallet's Artifactory registry proxies it), so this mirrors
5-
# the publish setup used by phantom/react-native-webview, just triggered by a release
6-
# rather than changesets since this fork is bumped infrequently.
3+
# Publishes @phantom/react-native-fast-image to public npm via npm Trusted Publishing
4+
# (keyless OIDC). Security enabled the Trusted Publisher for this repo + this workflow
5+
# file, so there is no NPM token to manage. Requires `id-token: write` and npm >= 11.5.1.
76
#
87
# To cut a release: bump "version" in package.json on main, then publish a GitHub
9-
# Release tagged v<version> (e.g. v8.6.6). This workflow publishes that version.
8+
# Release tagged v<version> (e.g. v8.6.6), or run this workflow manually.
109

1110
on:
1211
release:
@@ -15,6 +14,7 @@ on:
1514

1615
permissions:
1716
contents: read
17+
id-token: write
1818

1919
jobs:
2020
publish:
@@ -26,16 +26,17 @@ jobs:
2626
- uses: actions/setup-node@v4
2727
with:
2828
node-version: 20.x
29-
registry-url: "https://registry.npmjs.org"
30-
scope: "@phantom"
29+
30+
# Trusted Publishing (OIDC) requires npm >= 11.5.1; Node 20 ships npm 10.x.
31+
- name: Upgrade npm
32+
run: npm install -g npm@latest
3133

3234
- name: Install dependencies
3335
run: yarn install --frozen-lockfile
3436

3537
- name: Build
3638
run: yarn build
3739

40+
# No NODE_AUTH_TOKEN: npm exchanges the GitHub OIDC token via the Trusted Publisher.
3841
- name: Publish
3942
run: npm publish --access public
40-
env:
41-
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN_PHANTOM_SECURITY_BOT }}

0 commit comments

Comments
 (0)