|
4 | 4 | # root (package.json `"private": true`) is never published. |
5 | 5 | # |
6 | 6 | # Required repo configuration: |
7 | | -# - Secret: NPM_TOKEN (npm automation token with publish rights to the |
8 | | -# @agentruntimecontrolprotocol scope — create at npmjs.com → Access Tokens → Automation) |
| 7 | +# - npm Trusted Publisher must be configured on every |
| 8 | +# @agentruntimecontrolprotocol/* package (npmjs.com → package → Settings → |
| 9 | +# Trusted Publishers) pointing at: |
| 10 | +# repository: agentruntimecontrolprotocol/typescript-sdk |
| 11 | +# workflow: publish.yml |
| 12 | +# environment: (none) |
| 13 | +# With trusted publishers in place the workflow authenticates to npm via |
| 14 | +# the OIDC token GitHub Actions mints from `id-token: write`; no NPM_TOKEN |
| 15 | +# secret is needed. |
9 | 16 | # - The built-in GITHUB_TOKEN is used for GitHub Packages; the job grants |
10 | 17 | # `packages: write` below. |
11 | | -# - `id-token: write` is required for npm provenance (sigstore OIDC). |
| 18 | +# - `id-token: write` is required for both npm publish (trusted publisher |
| 19 | +# handshake) and npm provenance (sigstore attestation). |
12 | 20 |
|
13 | 21 | name: publish |
14 | 22 |
|
@@ -52,13 +60,15 @@ jobs: |
52 | 60 | version: 9.15.0 |
53 | 61 | run_install: false |
54 | 62 |
|
55 | | - - name: Setup Node.js (npm registry) |
| 63 | + - name: Setup Node.js |
| 64 | + # No registry-url/scope: that would cause setup-node to write an |
| 65 | + # `_authToken=${NODE_AUTH_TOKEN}` line into ~/.npmrc, which then |
| 66 | + # short-circuits the trusted-publisher OIDC handshake when no token is |
| 67 | + # present. The npm publish step passes --registry explicitly instead. |
56 | 68 | uses: actions/setup-node@v6 |
57 | 69 | with: |
58 | 70 | node-version: "22" |
59 | 71 | cache: "pnpm" |
60 | | - registry-url: "https://registry.npmjs.org" |
61 | | - scope: "@agentruntimecontrolprotocol" |
62 | 72 |
|
63 | 73 | - name: Install dependencies |
64 | 74 | run: pnpm install --frozen-lockfile |
|
86 | 96 | cat .publish-dirs.txt |
87 | 97 |
|
88 | 98 | - name: Publish to npm |
89 | | - env: |
90 | | - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 99 | + # No NODE_AUTH_TOKEN: npm CLI uses the OIDC token from `id-token: write` |
| 100 | + # against the npmjs.com trusted-publisher configured for each package. |
91 | 101 | run: | |
92 | 102 | set -euo pipefail |
93 | 103 |
|
|
0 commit comments