From 3ff90b418dd88d34f3bb25f48991e4a56fab294d Mon Sep 17 00:00:00 2001 From: Diego Resendez Date: Sat, 18 Jul 2026 14:53:28 -0500 Subject: [PATCH 1/2] ci: publish to npmjs via OIDC Trusted Publishing (no token) Replaces the NPM_AUTH secret on the prod path with npm Trusted Publishing: id-token: write + npm>=11.5.1, npm exchanges the OIDC token for a short-lived publish token and attaches provenance. Requires a trusted publisher configured on npmjs (Expressive-Tea/green-tea, release.yml). Signed-off-by: Diego Resendez --- .github/workflows/release.yml | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4eb5f05..fe18667 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,9 +1,9 @@ name: Release → npmjs # Production publish. Runs on GITHUB ONLY, on a version tag (`v*`). Publishes the stable -# package (version from package.json) to the public npmjs registry under `latest`. -# The tag arrives via the promote workflow; the version should be stable (no prerelease) -# before tagging. +# package to npmjs via OIDC **Trusted Publishing** — no long-lived token. Requires a trusted +# publisher configured on npmjs for this package (org Expressive-Tea, repo green-tea, +# workflow release.yml). npm also attaches build provenance automatically. on: push: tags: ['v*'] @@ -12,15 +12,17 @@ jobs: publish-prod: if: ${{ github.server_url == 'https://github.com' }} runs-on: ubuntu-latest + permissions: + id-token: write # OIDC for Trusted Publishing (also enables provenance) + contents: read steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: '22' registry-url: 'https://registry.npmjs.org' + - run: npm install -g npm@latest # npm >= 11.5.1 is required for OIDC trusted publishing - run: npm ci # `npm publish` runs prepublishOnly (lint + complexity + typecheck + test + build) first. - - name: Publish to npmjs - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH }} - run: npm publish --access public + # No NODE_AUTH_TOKEN — npm exchanges the OIDC id-token for a short-lived publish token. + - run: npm publish --access public -- 2.54.1 From 1a313c21adac7c1be5867b9ff7e4220d1f078167 Mon Sep 17 00:00:00 2001 From: Diego Resendez Date: Sat, 18 Jul 2026 14:59:48 -0500 Subject: [PATCH 2/2] ci: publish prereleases under their channel dist-tag, not latest A beta/alpha/rc version must not become 'latest' on npmjs (else npm install serves a prerelease). Derive the dist-tag from the version: 26.7.0-beta.0 -> beta, stable -> latest. Signed-off-by: Diego Resendez --- .github/workflows/release.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fe18667..acd4e8d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -25,4 +25,10 @@ jobs: - run: npm ci # `npm publish` runs prepublishOnly (lint + complexity + typecheck + test + build) first. # No NODE_AUTH_TOKEN — npm exchanges the OIDC id-token for a short-lived publish token. - - run: npm publish --access public + # A prerelease (26.7.0-beta.N) publishes under its channel tag (beta/alpha/rc) so `latest` + # never points at a beta; a stable version publishes under `latest`. + - name: Publish + run: | + TAG=$(node -e "const v=require('./package.json').version;const m=v.match(/-([a-z]+)/);console.log(m?m[1]:'latest')") + echo "dist-tag: $TAG" + npm publish --access public --tag "$TAG" -- 2.54.1