Skip to content

Commit def9efb

Browse files
beefoclaude
andcommitted
fix publish workflow for pure OIDC Trusted Publishing
- Remove registry-url from setup-node (it creates .npmrc with token auth) - Remove NODE_AUTH_TOKEN env var entirely - Upgrade npm to latest (>= 11.5.1 required for Trusted Publishing) - Use Node 22.x for publish job - Remove --provenance flag (automatic with Trusted Publishing) - Fix repository.url in package.json for provenance validation Co-Authored-By: Claude Opus 4.6 <[email protected]>
1 parent 37797cf commit def9efb

2 files changed

Lines changed: 16 additions & 17 deletions

File tree

.github/workflows/publish.yml

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
# Publishes the package to npm when a GitHub Release is created.
2-
# Uses a Granular Access Token for auth + OIDC for provenance attestation.
2+
# Uses npm Trusted Publishing (OIDC) — no access token needed.
33
#
4-
# Setup:
5-
# 1. Create a Granular Access Token on npmjs.com:
6-
# Settings → Access Tokens → Generate New Token → Granular Access Token
7-
# Scope it to read+write on the mg-api-js package only
8-
# 2. Add it as a GitHub repository secret named NPM_TOKEN:
9-
# Settings → Secrets and variables → Actions → New repository secret
10-
# 3. (Optional) Configure Trusted Publishing on npmjs.com for provenance:
11-
# https://www.npmjs.com/package/mg-api-js/access → Trusted Publishing
12-
# Repository owner: Geotab, Repository: mg-api-js, Workflow: publish.yml
4+
# Setup (one-time on npmjs.com):
5+
# 1. Go to https://www.npmjs.com/package/mg-api-js/access
6+
# 2. Under "Publishing access" → Configure Trusted Publishing
7+
# 3. Add a new trusted publisher:
8+
# - Repository owner: Geotab
9+
# - Repository name: mg-api-js
10+
# - Workflow filename: publish.yml
11+
# - Environment: (leave blank)
1312
#
1413
# Usage:
1514
# 1. Bump the version: npm version patch|minor|major
@@ -37,8 +36,10 @@ jobs:
3736
- name: Setup Node.js
3837
uses: actions/setup-node@v4
3938
with:
40-
node-version: 20.x
41-
registry-url: https://registry.npmjs.org
39+
node-version: 22.x
40+
41+
- name: Upgrade npm for Trusted Publishing
42+
run: npm install -g npm@latest
4243

4344
- name: Install dependencies
4445
run: npm ci
@@ -58,7 +59,5 @@ jobs:
5859
exit 1
5960
fi
6061
61-
- name: Publish to npm with provenance
62-
run: npm publish --provenance --access public
63-
env:
64-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
62+
- name: Publish to npm
63+
run: npm publish --access public

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"test:node": "npm run mocha:node"
2020
},
2121
"repository": {
22-
"url": "https://github.com/Geotab/mg-api-js",
22+
"url": "git+https://github.com/Geotab/mg-api-js.git",
2323
"type": "git"
2424
},
2525
"license": "MIT",

0 commit comments

Comments
 (0)