Add tag-triggered GitHub Actions workflow to publish releases to PyPI#21
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e5b7a96876
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| tags: | ||
| - "v*" |
There was a problem hiding this comment.
Enforce tag/version consistency before publishing
When any v* tag is pushed, this workflow builds and publishes the static version declared in pyproject.toml (0.1.0 currently) without checking that it matches the tag. If a maintainer pushes v0.2.0 before bumping the project metadata, PyPI will receive the old version and the GitHub release for v0.2.0 will attach artifacts named for 0.1.0; add a pre-publish check comparing ${GITHUB_REF_NAME#v} to the built package metadata version or derive the version from the tag.
Useful? React with 👍 / 👎.
Motivation
v*tag is pushed so releases and PyPI publishing are consistent and reproducible.Description
.github/workflows/release.ymlwhich triggers onpushof tags matchingv*and grantscontents: writeandid-token: writepermissions.buildjob that checks out the repo, sets up Python withactions/setup-python@v5, installs build tooling, runspython -m build, and uploadsdist/*as artifacts usingactions/upload-artifact@v4.publish-pypijob that downloads the built artifacts and publishes them usingpypa/gh-action-pypi-publish@release/v1scoped to apypienvironment.github-releasejob that downloads the artifacts and creates a GitHub release with the distributions attached usingsoftprops/action-gh-release@v2.Testing
git diff --checkwhich reported no whitespace errors and passed.python -m buildlocally which failed because thebuildmodule was not available in the environment.python -m pip install --user --upgrade build && python -m buildwhich failed due to network/proxy403 Forbiddenwhen fetchingbuild.Codex Task