Repository navigation
chore(ci): add PyPI trusted publishing workflow - #470
Open
jahirvidrio wants to merge 1 commit into
Open
jahirvidrio wants to merge 1 commit into
jahirvidrio wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The release smoke test can skip installing the built wheel because leftover nodeenv.egg-info appears already installed, leaving no bin/nodeenv and blocking publication; the install needs --force-reinstall.
1 open issue
What changed in this PR
Adds tag-triggered PyPI trusted publishing for nodeenv, implementing the automation proposed in #416 while keeping release timing under maintainer control.
Changes:
- Checks that the version tag matches
nodeenv_versionbefore building the sdist and wheel. - Validates distribution metadata and adds a wheel installation smoke test.
- Publishes the build artifacts through the
pypienvironment, with SHA-pinned actions and OIDC permission limited to the publish job.
| File | Description |
|---|---|
.github/workflows/release.yml |
Adds separate build-validation and trusted-publishing jobs for version-tag releases. |
Review effort: Balanced
| run: | | ||
| set -euo pipefail | ||
| python -m venv "${RUNNER_TEMP}/smoke" | ||
| "${RUNNER_TEMP}/smoke/bin/python" -m pip install --quiet dist/*.whl |
This branch has not been deployed
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.

Adds
.github/workflows/release.yml, the trusted publishing workflow discussed in #416. Pushing a bare version tag builds the sdist and wheel withpython -m buildand uploads them to PyPI through OIDC, with no credentials stored in the repository. No other workflow is touched.The guard rails:
pushon tags matching digit.digit.digit triggers it, so an unrelated tag likedocs-2026leaves the workflow alone.id-token: writeis granted to thepublishjob only.buildkeeps the workflow-levelcontents: read.publishruns in thepypienvironment.GITHUB_REF_NAMEwithnodeenv_versionfromnodeenv.py, so a mismatch fails in seconds instead of after the dist is built. If the value cannot be read, the step fails loudly rather than comparing against an empty string.buildrunstwine checkon both artifacts, installs the wheel into a throwaway venv and comparesnodeenv --versionwith the tag. A broken wheel fails the job, andpublishneedsbuild.publishuploads the artifactbuildproduced and checked, nothing else.Tests are not part of this change: it adds one workflow file, and nothing in
tests/covers.github/. I kept the diff torelease.ymlas asked.Fixes #416
toxpasses: the tests and flake8CHANGEShas an entry underVersion [unreleased], if nodeenv'sbehavior changes
README.rstis updated, if the change affects what it documentstype(scope): subject