Skip to content

Commit 4e705c8

Browse files
committed
fix(release): stop the publish job shipping an unbuildable sdist
docs/RELEASING.md opens with "Wheels only - never publish an sdist" and explains why: src/* is gitignored, so the tarball carries Cargo.toml and build.rs but no .rs sources. Any platform without a matching wheel falls back to it, attempts a source build, and fails with a confusing Rust error instead of a clean "no wheel available". PyPI holds 15 wheels and zero sdists for 0.6.8. The publish job contradicted that policy directly - its collect step copied *.tar.gz into dist/ alongside the wheels, so tagging v0.7.0 would have uploaded one. Nothing in the pipeline would have objected; twine check accepts sdists quite happily. Collect wheels only, and add two guards that fail the job loudly rather than let it ship quietly: refuse if any .tar.gz reached dist/, and refuse if no wheel did. The sdist job still runs and still uploads its tarball as a workflow artifact for inspection; it simply never reaches PyPI.
1 parent 65330f2 commit 4e705c8

1 file changed

Lines changed: 22 additions & 1 deletion

File tree

.github/workflows/release-build.yml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,10 +392,31 @@ jobs:
392392
- name: Collect distributions
393393
run: |
394394
mkdir -p dist
395+
# Wheels only, per docs/RELEASING.md. An sdist for this project is
396+
# unbuildable by design: `src/*` is gitignored, so the tarball carries
397+
# Cargo.toml and build.rs but no .rs sources. Publishing one means any
398+
# platform without a matching wheel falls back to it, attempts a source
399+
# build, and fails with a confusing Rust error instead of a clean
400+
# "no wheel available". PyPI holds 15 wheels and zero sdists for 0.6.8;
401+
# this step is what keeps it that way.
402+
#
403+
# The sdist job still runs and still uploads its tarball as a workflow
404+
# artifact for inspection. It simply never reaches dist/, and therefore
405+
# never reaches PyPI.
395406
find artifacts -name '*.whl' -exec cp {} dist/ \;
396-
find artifacts -name '*.tar.gz' -exec cp {} dist/ \;
397407
ls -la dist/
398408
409+
# Belt and braces: fail loudly rather than silently shipping the thing
410+
# the policy exists to prevent.
411+
if ls dist/*.tar.gz >/dev/null 2>&1; then
412+
echo "::error::an sdist reached dist/ — refusing to publish (docs/RELEASING.md)"
413+
exit 1
414+
fi
415+
if ! ls dist/*.whl >/dev/null 2>&1; then
416+
echo "::error::no wheels were collected — refusing to publish an empty release"
417+
exit 1
418+
fi
419+
399420
- name: Check metadata
400421
run: |
401422
pip install twine

0 commit comments

Comments
 (0)