From d13dcf17cc41654128779e9cde4f43e919f6a5f7 Mon Sep 17 00:00:00 2001 From: Keshav Malik <33570148+theinfosecguy@users.noreply.github.com> Date: Sun, 14 Jun 2026 23:34:51 +0530 Subject: [PATCH] ci: publish to npm via OIDC trusted publishing in the release workflow --- .github/workflows/release.yml | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6247729..fcfe61b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,10 +1,10 @@ name: Release -# Release gate: run the heavy package smoke test BEFORE any release. It packs, -# installs the tarball, scaffolds Node and Express apps, boots their servers and -# verifies a live HTTP response. This is intentionally kept out of the per-PR -# ci.yml job. No registry publish credentials are configured here; the workflow -# only proves the published package works end to end. +# Release pipeline: +# 1) smoke: pack, install the tarball, scaffold Node and Express apps, boot their +# servers and verify a live HTTP response. Kept out of the per-PR ci.yml job. +# 2) publish: on a version tag, publish to npm using OIDC trusted publishing +# (no long-lived token; provenance is attached automatically). on: push: tags: @@ -28,3 +28,28 @@ jobs: - name: Run package smoke test run: npm run test:package + + publish: + needs: smoke + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/v') + + permissions: + contents: read + id-token: write + + steps: + - uses: actions/checkout@v4 + + - name: Use Node.js 20 + uses: actions/setup-node@v4 + with: + node-version: 20 + registry-url: 'https://registry.npmjs.org' + + # Trusted publishing (OIDC) requires npm >= 11.5.1. + - name: Upgrade npm + run: npm install -g npm@latest + + - name: Publish to npm + run: npm publish