ci: grant id-token permission for PyPI trusted publishing - #12
Merged
Conversation
The publish job inherited the workflow-level `permissions: contents: read`, which drops the default OIDC grant — GitHub then never exposes ACTIONS_ID_TOKEN_REQUEST_URL to the job, so `uv publish` cannot mint a trusted-publishing token and fails with "Trusted publishing failed ... Missing credentials". Add job-level `id-token: write`. Also add zeeker-common to the workflow_dispatch package choice and honor the input in the build step (release events still default to zeeker), so zeeker-common 0.2.0 can be published from the same workflow. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Cuh5eJDfVowgpp22s7siE1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The 0.9.0 publish run failed:
The workflow declares
permissions: contents: readat the top level, which replaces the default token grants for every job — so the publish job has noid-tokenpermission, GitHub never exposes the OIDC endpoint to the runner, anduv publish(which was correctly attempting Trusted Publishing afterUV_PUBLISH_TOKENwas removed) falls through to an unauthenticated upload.Fix
permissions: { contents: read, id-token: write }on the publish job.zeeker-commonadded to theworkflow_dispatchpackage choice and the build step honors the input (releaseevents still default tozeeker), so zeeker-common 0.2.0 can ship from the same workflow.Trusted Publishing also requires a matching publisher configuration on pypi.org, or the OIDC token will be minted but rejected:
zeeker-sg(nothoufu— the repo moved orgs; a publisher registered under the old owner will not match), repositorycli, workflowpublish-zeeker.yml, environmentrelease.zeeker-commondoesn't exist on PyPI yet, add it as a pending publisher (PyPI → Your account → Publishing → "Add a pending publisher") so the first upload can create it.release(Settings → Environments) since the job pinsenvironment: releaseand the PyPI publisher config references it.After merging, re-run the failed publish (re-publish the release or
workflow_dispatchwith packagezeeker), then dispatch once more withzeeker-common.🤖 Generated with Claude Code
https://claude.ai/code/session_01Cuh5eJDfVowgpp22s7siE1
Generated by Claude Code