fix(ci): run pypi-publish before Sigstore signing writes to dist/

The v0.6.8 release run failed at the PyPI publish step:

  Checking dist/semantica-0.6.8-py3-none-any.whl.sigstore.json: ERROR
  InvalidDistribution: Unknown distribution format

pypa/gh-action-pypi-publish uploads everything under packages-dir
(default dist/) with no include/exclude filter, so once the Sigstore
signing step (added in #1329) started writing dist/*.sigstore.json
alongside the wheel/sdist, publish was broken for every release from
that point on - it just never ran, since v0.6.7 was tagged two days
before #1329 merged. Confirmed nothing was uploaded to PyPI before
failing (dist/*.whl checked and passed first; the sigstore.json file
failed validation before any upload began).

Fix: run pypi-publish immediately after the package build, before the
Sigstore/attest-build-provenance steps write anything else into dist/.
The GitHub Release upload (which needs the .sigstore.json files) still
runs after signing, unaffected by the reorder.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
KaifAhmad1
2026-09-05 19:25:51 +05:30
co-authored by Claude Sonnet 5
parent a65874e45b
commit f73f599a22
+7 -2
View File
@@ -67,6 +67,12 @@ jobs:
run: |
pip install -r .github/requirements/twine.txt --require-hashes
twine check dist/*
# pypi-publish uploads everything under packages-dir (default: dist/) with
# no glob/include filter, so it must run before anything else writes a
# non-distribution file into dist/ - the Sigstore step below does exactly
# that (dist/*.sigstore.json), and pypi-publish fails on it with
# "InvalidDistribution: Unknown distribution format" if it runs after.
- uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # release/v1
- name: Attest build provenance
uses: actions/attest-build-provenance@4d101475d8b20a2381f78447822ac1eab6504dd8 # v4
with:
@@ -75,7 +81,7 @@ jobs:
# OpenSSF Scorecard's Signed-Releases check does not inspect - it looks for
# signature files attached as release assets. Sign here too so
# `dist/*.sigstore.json` bundles ship alongside the wheel/sdist on the
# GitHub Release itself.
# GitHub Release itself. This must run after pypi-publish (see above).
- name: Sign artifacts with Sigstore
uses: sigstore/gh-action-sigstore-python@790bc6befb9d733738f18d8f895854b453640ec9 # v3.5.0
with:
@@ -88,4 +94,3 @@ jobs:
dist/*.whl
dist/*.tar.gz
dist/*.sigstore.json
- uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # release/v1