Repository navigation
ci: publish package to PyPI on release tags - #30
Conversation
|
[P1] Authorize the original tag pusher on re-runs
Please validate GitHub documents this distinction here: https://docs.github.com/en/actions/reference/workflows-and-actions/contexts#github-context Resumo em português A checagem atual valida quem clicou para reexecutar o workflow, não necessariamente quem criou a tag. Assim, uma tag criada por alguém sem permissão de release pode acabar sendo publicada caso um mantenedor reexecute o workflow. Como reproduzir
|
|
Confirmed fixed. The workflow now validates both |
Summary
Automates publishing
conviso-clito PyPI when a release tag is pushed, restricts who can trigger a release, and fixes a packaging issue that would break the published package.Changes
.github/workflows/publish-pypi.yml, triggered only by tags matchingvX.Y.Z:authorize– both the user who pushed the tag (github.actor) and the user who started the run (github.triggering_actor, which differs on re-runs) must haveadminormaintainrole on the repository.tests– installs the package and runspytest.version-check– fails if the tag (minusv) differs fromsrc/conviso/VERSION.build-and-publish-pypi–python -m build,twine check,twine uploadusing theSRE_PYPI_TOKENsecret.pyproject.toml):security_gate_rules_schema.jsonwas not included in the wheel, soconviso security-gatewould fail when installed from PyPI.VERSIONand*.jsonare now declared as package data.CONTRIBUTING.md): new "Releases" section describing the SemVer +vX.Y.Ztag convention.Security
Since this is a public repository, publishing is restricted:
The
authorizejob checks the role of both the tag pusher and the run initiator (granted through theconvisolabsorganization), so a maintainer re-running the workflow cannot publish a tag pushed by an unauthorized user.Workflow token permissions are limited to
contents: read.Concurrent releases are prevented.
Direct org/team membership is not checked because the default
GITHUB_TOKENcannot read private organization membership; doing so would require an extra token withread:org.Known limitation:
SRE_PYPI_TOKENis a repository secret, so a user with write access could still expose it through another workflow. Recommended follow-ups:v*tags to the release team.Release convention
New releases are tagged
vX.Y.Z. Existing bare tags (0.3.9, …) remain untouched. Tags in any other format do not trigger publishing.How to test
pip wheel --no-deps . -w dist && unzip -l dist/*.whl | grep -E "VERSION|\.json"– both files should be listed.src/conviso/VERSIONand push a matching tag (e.g.v0.5.2) as a maintainer to trigger the first publish.