Use trusted publishing for PyPI releases - #193
Conversation
Signed-off-by: Jacob Yundt <me@jyundt.com>
| 1. Update ``CHANGELOG.md``, ``setup.py``, and ``src/redfish/__init__.py`` with | ||
| the new version in a pull request. | ||
| 2. Merge the pull request. | ||
| 3. Create a GitHub release from the merged commit with the version as its tag. |
There was a problem hiding this comment.
Could we keep this its own workflow (thus preserving the removed portions in the Release and Publish flow). I like the ease of having a push-button approach to updating versions/changelogs.
|
@mraineri It seems the current hesitation stems from a reluctance to lose the convenience of the original "push-button" automation for managing versions and changelogs. However, GitHub Actions can actually deliver the best of both worlds—preserving that ease of use while fully complying with PyPI's strict OIDC security requirements. We can split this into a seamless two-step automated workflow:
By separating the repository automation from the secure publication phase, we can maintain the exact single-button convenience the maintainers prefer, while granting Home Assistant the publicly verifiable supply chain transparency it requires. What do you think about this approach? |
Summary
setup.py,redfish.__version__, and the changelogMotivation
The current workflow updates and pushes release sources during a manually dispatched job, then builds and publishes with a stored
PYPI_API_TOKEN. Although the work is visible in GitHub Actions, that process does not produce PyPI provenance attestations and makes it harder for downstream projects to verify the relationship between reviewed source, the release tag, and the published distributions.This change makes the reviewed and tagged source the release input. Publishing a GitHub release starts a clean build from that tag, transfers only the resulting distributions to a dedicated publishing job, and authenticates to PyPI with a short-lived OIDC credential. The PyPI action generates attestations for the uploaded files.
This was prompted by the dependency-transparency review for the downstream Home Assistant Redfish integration.
Maintainer setup required
Before the first release using this workflow:
pypienvironment in this GitHub repository. Environment protection or required reviewers can be added if desired.redfishproject, add a GitHub Trusted Publisher with:DMTFpython-redfish-librarymain.ymlpypiPYPI_API_TOKENrepository secret.This draft should not be merged until the maintainers responsible for PyPI confirm that the Trusted Publisher can be configured.
Validation
actionlint .github/workflows/main.yml: passedzizmor .github/workflows/main.yml: no findings3.3.9: passedtwine checkfor both distributions: passedThe existing
tox -e pep8target continues to report pre-existing formatting errors in files untouched by this change.