ci: gate PyPI publish on a protected-environment approval - #10
Merged
Conversation
Split publish into a reusable release.yml (full CI gate: ruff, mypy, pytest, build, twine check) that runs on the exact tag SHA before the PyPI publish job, which now waits on approval via the existing pypi environment. pypi-publish.yml is now a thin tag-triggered caller.
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.
What
Splits the PyPI publish workflow into a reusable
release.ymlgate and athin tag-triggered caller, so the full CI gate (ruff, mypy, pytest, build,
twine check) runs on the exact release SHA and the publish job waits on
the existing
pypienvironment before it can run.pypi-publish.ymlnow only triggers onv*.*.*tags and callsrelease.yml— no more building/publishing directly on any push.release.ymlruns the same checks asci.yml(ruff check,mypy,pytest) across the same Python 3.11-3.13 matrix asci.yml, then asingle-version build +
twine check, uploads the dist, then publishesto PyPI via trusted publishing (unchanged) and creates the GitHub
Release, gated behind the
pypienvironment.This mirrors the shape adopted in
python-tesla-fleet-api'srelease.yml/python-publish.yml.Needs admin follow-up: the
pypienvironment already exists but hasno required reviewers configured, so the "protected-environment approval"
step is currently a no-op gate. Someone with environment-admin access
needs to add required reviewers to the
pypienvironment for theapproval step to actually block publishing.