Skip to content

release: 0.4.3 — publish to PyPI via trusted publishing - #30

Merged
narko4u merged 1 commit into
mainfrom
release/pypi-0.4.3
Sep 16, 2026
Merged

narko4u merged 1 commit into
mainfrom
release/pypi-0.4.3

Conversation

@narko4u

@narko4u narko4u commented Sep 16, 2026

Copy link
Copy Markdown
Owner

Adds PyPI publication, and the release guards that make it safe.

Publishing. A publish job uploads the distributions over GitHub OIDC
trusted publishing — no API token, no stored secret — with build attestations
attached, so a consumer can check provenance on the project page. It is held
closed behind the repository variable PYPI_PUBLISH_ENABLED, so a tag push
never leaves a failed run merely because the publisher is not configured yet.

Why the upload payload is its own artifact. The upload action rejects any
file in packages-dir that is not a wheel or a sdist:

InvalidDistribution: Unknown distribution format: 'SHA256SUMS'

so the distributions are now kept as a separate artifact containing only the
wheel and the sdist. The checksums, SBOM and signatures remain release assets,
and a step in the publish job asserts the payload before the exchange with PyPI
rather than during it.

Guards. PyPI never allows a filename to be reused, so a distribution whose
version does not match its tag would permanently burn that version number on
mismatched code. Two steps now fail the run before anything is signed or
uploaded: the built distributions must carry the tag version, and the package
must report it — a source-tree fallback that drifts is invisible until a user
runs --version, which is exactly how 0.2.1 shipped reporting 0.2.0.

Verified locally on this branch:

  • python -m build produces mcp_evidence_validator-0.4.3-*
  • PYTHONPATH=src python -m pytest -q — 50 passed
  • PYTHONPATH=src python -c "import mcp_evidence_validator as m; print(m.__version__)" — 0.4.3

Once merged I will tag the merge commit v0.4.3. The PyPI pending publisher is
already registered for this repository, release.yml and the pypi
environment.

… the upload

Adds PyPI trusted publishing over OIDC with build attestations, held closed behind the PYPI_PUBLISH_ENABLED repository variable. The distributions are handed to the publisher as their own artifact, so the checksums, SBOM and signatures stay release assets: the upload action rejects any non-distribution file in its payload.

Adds release guards that assert the built distributions carry the tag version, and that the package reports it, before anything is signed or uploaded.

Signed-off-by: Empire Labs Pty Ltd <narko4u@gmail.com>
@narko4u
narko4u merged commit afc9a6d into main Sep 16, 2026
8 checks passed
@narko4u
narko4u deleted the release/pypi-0.4.3 branch September 16, 2026 11:53

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f17677d589

ℹ️ 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".

Comment on lines +143 to +147
- name: Fetch the distributions built by the release job
uses: actions/download-artifact@v4
with:
name: dist
path: dist

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Build the requested tag before publishing

On a workflow_dispatch run, the release job's checkout has no ref, so it builds the branch or tag selected when launching the workflow rather than the independent tag input. This download can therefore feed PyPI branch-built artifacts: if that ref contains untagged changes without a version bump, both version guards pass and the immutable PyPI release differs from the requested Git tag. Resolve and check out the validated input tag before building manual releases.

Useful? React with 👍 / 👎.

fi
for f in "${files[@]}"; do
base="$(basename "$f")"
if ! grep -Eq "(^|[-_])${esc}([-_.]|$)" <<< "$base"; then

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Require an exact distribution version match

The regex treats ., _, and - after the expected text as valid boundaries, so a tag such as v0.4.3 accepts distributions named with versions like 0.4.3.post1 or 0.4.3.1. If pyproject.toml drifts to one of those versions while the source fallback remains 0.4.3, the second guard also passes and the workflow publishes the wrong immutable version under the tag; extract the wheel/sdist version field and compare it exactly instead.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant