Skip to content

Commit 67e2c04

Browse files
authored
Enable NPM trusted publishing with OIDC (#35)
## Summary Update npm publish workflow to use OIDC trusted publishing with provenance. ## Changes - Add `id-token: write` and `contents: read` permissions for OIDC authentication - Use `yarn npm publish` with `--provenance` flag for supply chain security - Remove `yarn pack` step (no longer needed with direct yarn publishing) - Update actions to v6 - Remove `NODE_AUTH_TOKEN` secret (no longer needed with OIDC) ## Status ✅ Trusted publishing has been configured on npmjs.com for this package.
1 parent 6fa125b commit 67e2c04

File tree

4 files changed

+9
-11
lines changed

4 files changed

+9
-11
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,14 @@ jobs:
1313
runs-on: ubuntu-latest
1414

1515
permissions:
16+
contents: read
1617
# https://docs.npmjs.com/generating-provenance-statements#publishing-packages-with-provenance-via-github-actions
1718
id-token: write
1819

1920
steps:
20-
- uses: actions/checkout@v4.2.2
21+
- uses: actions/checkout@v6
2122
- run: corepack enable
22-
- uses: actions/setup-node@v4.1.0
23+
- uses: actions/setup-node@v6
2324
with:
2425
node-version: 22.x
2526
registry-url: https://registry.npmjs.org
@@ -30,10 +31,6 @@ jobs:
3031
- run: yarn run build
3132
- run: yarn run test
3233

33-
- run: yarn pack
3434
- name: Publish to NPM
3535
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
36-
# `yarn npm publish` does not currently support --provenance: https://github.com/yarnpkg/berry/issues/5430
37-
run: npm publish package.tgz --provenance --access public
38-
env:
39-
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
36+
run: yarn npm publish --provenance --access public

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,3 +110,4 @@ dist
110110
!.yarn/plugins
111111
!.yarn/sdks
112112
*.tgz
113+
.DS_Store

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"license": "MIT",
66
"repository": {
77
"type": "git",
8-
"url": "https://github.com/foxglove/message-definition.git"
8+
"url": "git+https://github.com/foxglove/message-definition.git"
99
},
1010
"keywords": [
1111
"schema",
@@ -52,5 +52,5 @@
5252
"typescript": "5.9.3",
5353
"typescript-eslint": "8.13.0"
5454
},
55-
"packageManager": "yarn@4.5.1"
55+
"packageManager": "yarn@4.12.0"
5656
}

yarn.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5532,11 +5532,11 @@ __metadata:
55325532

55335533
"typescript@patch:typescript@npm%3A5.9.3#optional!builtin<compat/typescript>":
55345534
version: 5.9.3
5535-
resolution: "typescript@patch:typescript@npm%3A5.9.3#optional!builtin<compat/typescript>::version=5.9.3&hash=cef18b"
5535+
resolution: "typescript@patch:typescript@npm%3A5.9.3#optional!builtin<compat/typescript>::version=5.9.3&hash=5786d5"
55365536
bin:
55375537
tsc: bin/tsc
55385538
tsserver: bin/tsserver
5539-
checksum: 10c0/6f7e53bf0d9702350deeb6f35e08b69cbc8b958c33e0ec77bdc0ad6a6c8e280f3959dcbfde6f5b0848bece57810696489deaaa53d75de3578ff255d168c1efbd
5539+
checksum: 10c0/ad09fdf7a756814dce65bc60c1657b40d44451346858eea230e10f2e95a289d9183b6e32e5c11e95acc0ccc214b4f36289dcad4bf1886b0adb84d711d336a430
55405540
languageName: node
55415541
linkType: hard
55425542

0 commit comments

Comments
 (0)