Interview Prep/GitHub Actions/Runners, ARC, Monorepos & Releases

A release must publish to npm with provenance. What does the workflow need?

AdvancedScenarioRunners, ARC, Monorepos & Releases
Answer

Situation read → npm provenance uses GitHub OIDC.

What I'd do →

  1. Workflow:
    permissions:
      contents: read
      id-token: write
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with: { node-version: 22, registry-url: "https://registry.npmjs.org" }
      - run: npm ci && npm publish --provenance --access public
        env:
          NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
    
  2. Better: npm trusted publishing (OIDC) configured on npmjs.com for the repo and workflow, removing NPM_TOKEN entirely.

Why → Provenance links the package to the source and build; trusted publishing removes the long-lived token.

Interview tip → Mention trusted publishing exists for npm and PyPI now.

All GitHub Actions questions Roadmap: GitHub Actions

More on Runners, ARC, Monorepos & Releases