Skip to content

ci: publish to npm with trusted publishing (OIDC) instead of NPM_TOKEN - #45

Merged
dhruva-vapi merged 1 commit into
mainfrom
dr/npm-trusted-publishing
Oct 27, 2026
Merged

dhruva-vapi merged 1 commit into
mainfrom
dr/npm-trusted-publishing

Conversation

@dhruva-vapi

@dhruva-vapi dhruva-vapi commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Value

Vapi package consumers keep receiving the built release while dependency scripts and build tools lose access to npm publishing credentials. The previous job granted OIDC access during installation and builds, which allowed any code running there to request publishing credentials.

What changed

Build, validation, version checks and packing run without OIDC permission. The package tarball is uploaded as an artifact. A separate publish job has only id-token: write, downloads that artifact and publishes it with lifecycle scripts disabled. It performs no checkout, dependency installation or build, and Node package-manager caching is disabled. Artifact transfer and privileged setup actions are pinned to immutable commits.

The workflow filename stays the same, so the npm trusted publisher configured on October 27 remains applicable. npm requires a first successful publish within 48 hours of creation. Recreate the configuration if it expires before that release. Existing npm token secrets remain until OIDC publication succeeds.

Library and widget builds pass. The packed widget contains the built library, declarations and embed script.

Uploaded tarballs are retained for one day. If a failed publish is retried after that, re-run all jobs to recreate the artifact.

Testing plan

  • actionlint and whitespace validation pass.
  • Actual package builds and packed artifact contents checked locally.
  • Tarballs exercised in dry-run mode against a disposable local registry from a clean directory without a checkout or dependencies.
  • A fixture with deliberately failing lifecycle hooks fails normal packing and succeeds with scripts disabled during pack and publish dry-run.

No new version was published and no real OIDC release was triggered by this change. Final OIDC verification happens on the next intended release. Build checks use Node 22.22.3. Artifact publishing smoke checks use Node 24.19.0 with npm 12.2.1 and a disposable local registry. The workflow uses Node 24 with its bundled npm.

## Value

Vapi package consumers keep receiving the built release while dependency scripts and build tools lose access to npm publishing credentials. The previous job granted OIDC access during installation and builds, which allowed any code running there to request publishing credentials.

## What changed

Build, validation, version checks and packing run without OIDC permission. The package tarball is uploaded as an artifact. A separate publish job has only `id-token: write`, downloads that artifact and publishes it with lifecycle scripts disabled. It performs no checkout, dependency installation or build, and Node package-manager caching is disabled. Artifact transfer and privileged setup actions are pinned to immutable commits.

The workflow filename stays the same, so the npm trusted publisher configured on October 27 remains applicable. npm requires a first successful publish within 48 hours of creation. Recreate the configuration if it expires before that release. Existing npm token secrets remain until OIDC publication succeeds.

Library and widget builds pass. The packed widget contains the built library, declarations and embed script.

Uploaded tarballs are retained for one day. If a failed publish is retried after that, re-run all jobs to recreate the artifact.

## Testing plan

- actionlint and whitespace validation pass.
- Actual package builds and packed artifact contents checked locally.
- Tarballs exercised in dry-run mode against a disposable local registry from a clean directory without a checkout or dependencies.
- A fixture with deliberately failing lifecycle hooks fails normal packing and succeeds with scripts disabled during pack and publish dry-run.

No new version was published and no real OIDC release was triggered by this change. Final OIDC verification happens on the next intended release. Build checks use Node 22.22.3. Artifact publishing smoke checks use Node 24.19.0 with npm 12.2.1 and a disposable local registry. The workflow uses Node 24 with its bundled npm.
@dhruva-vapi
dhruva-vapi force-pushed the dr/npm-trusted-publishing branch from 0480a34 to 51c327f Compare October 27, 2026 16:41
@dhruva-vapi
dhruva-vapi merged commit e191567 into main Oct 27, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants