Skip to content

feat: enable trusted publishing - #54

Draft
ObserverOfTime wants to merge 1 commit into
mainfrom
trusted-publishing
Draft

feat: enable trusted publishing#54
ObserverOfTime wants to merge 1 commit into
mainfrom
trusted-publishing

Conversation

@ObserverOfTime

@ObserverOfTime ObserverOfTime commented Dec 14, 2025

Copy link
Copy Markdown
Member

For npm, crates, pypi packages

@ObserverOfTime
ObserverOfTime force-pushed the trusted-publishing branch 2 times, most recently from 744d28a to 3bc4915 Compare December 14, 2025 10:42
@ObserverOfTime ObserverOfTime linked an issue Jun 30, 2026 that may be closed by this pull request
dpezto added a commit to dpezto/tree-sitter-gnuplot that referenced this pull request Jul 23, 2026
Replace the token-authenticated PyPI publish with OIDC trusted publishing,
removing the long-lived PYPI_API_TOKEN from the release path.

tree-sitter/workflows' package-pypi.yml requires PYPI_API_TOKEN and does not
expose id-token: write, and a caller cannot inject permissions into a reusable
workflow's internal jobs. The upstream fix (tree-sitter/workflows#54) is an
unmerged draft, so the workflow is vendored here with that patch applied: the
token secret is optional and the publish job carries id-token: write.

release.yml calls the local copy, grants contents: read + id-token: write to
the reusable workflow, and no longer passes PYPI_API_TOKEN, so
gh-action-pypi-publish authenticates through the OIDC id-token. Requires a
GitHub trusted publisher configured on the PyPI project (workflow release.yml,
environment pypi).

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
dpezto added a commit to dpezto/tree-sitter-gnuplot that referenced this pull request Jul 23, 2026
ci(release): publish to npm and crates.io via OIDC trusted publishing

Extend OIDC trusted publishing to the npm and crates.io release jobs, removing
the long-lived NPM_TOKEN and CARGO_REGISTRY_TOKEN from the release path (the
PyPI job already moved to OIDC).

As with PyPI, tree-sitter/workflows' package-npm.yml and package-crates.yml
require their token secrets and expose no id-token permission, and the upstream
fix (tree-sitter/workflows#54) is an unmerged draft, so both are vendored here
with that patch applied and adapted per registry:

- npm: the auth token is optional and the publish job carries id-token: write.
  npm is upgraded to a trusted-publishing-capable release (>= 11.5.1) before
  publish, since the bundled npm predates OIDC support. When NODE_AUTH_TOKEN is
  unset, npm publish authenticates through the OIDC id-token.
- crates.io: the registry token is optional and the publish job carries
  id-token: write. When no token is set, rust-lang/crates-io-auth-action mints
  a short-lived token via OIDC, which cargo publish then uses.

release.yml calls the local copies, grants contents: read + id-token: write to
each reusable workflow, and no longer passes the token secrets. Both require a
GitHub trusted publisher configured on the respective registry (workflow
release.yml; environments npm and crates).

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
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.

Trusted publishing without access tokens

1 participant