Skip to content
This repository was archived by the owner on Oct 27, 2026. It is now read-only.

Publish to PyPI with Trusted Publishing - #108

Merged
exhuma merged 1 commit into
masterfrom
ci/pypi-trusted-publishing
Oct 27, 2026
Merged

exhuma merged 1 commit into
masterfrom
ci/pypi-trusted-publishing

Conversation

@exhuma

@exhuma exhuma commented Oct 27, 2026

Copy link
Copy Markdown
Owner

The v5.2.0 tag run (40532017670) passed tests and build, but publishing failed. The job still expected a pypi_token secret, which is gone now that PyPI publishing uses Trusted Publishing. pypa/gh-action-pypi-publish therefore fell back to OIDC without the id-token: write permission. Nothing was uploaded; PyPI still shows 5.1.0.

This PR changes the publish job to match x690's:

  • environment: pypi and permissions: id-token: write; no token
  • runs only for v* tags, and waits for test, docs and build
  • before uploading, checks that the tag matches config_resolver/version.txt. x690 uses uv version --short, which refuses the dynamic version here (We cannot get or set dynamic project versions), so the step reads the file setuptools uses. I tested the check locally: v5.2.0 passes, v5.2.1 fails.

After merging

A tag run uses the workflow from the tagged commit, so the existing v5.2.0 tag (on 47c4f2c, with the old job) can't publish. Since nothing reached PyPI, the tag can move to this PR's merge commit:

git push origin :refs/tags/v5.2.0
git tag -a v5.2.0 -m "Release 5.2.0, the final release" <merge-commit>
git push origin v5.2.0

The PyPI trusted publisher must name this repository, the workflow pythonpackage.yml and the environment pypi.

🤖 Generated with Claude Code

The v5.2.0 tag run failed to publish: the job still expected a
pypi_token secret, which no longer exists, so the publish action fell
back to Trusted Publishing without the id-token permission it needs.

Publish the way x690 does: run in the "pypi" environment with
id-token: write and no token, and only for v* tags. Before uploading,
check that the tag matches config_resolver/version.txt (uv version
cannot read a dynamic version). The job now also waits for the docs
build.

Co-Authored-By: Claude <noreply@anthropic.com>
@exhuma exhuma self-assigned this Oct 27, 2026
@exhuma
exhuma merged commit 04332bc into master Oct 27, 2026
20 checks passed
@exhuma
exhuma deleted the ci/pypi-trusted-publishing branch October 27, 2026 15:37
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant