Skip to content

Commit 4896512

Browse files
committed
fix(release): keep dist/ pure for twine; bundle moves to bundle/
The v0.3.1 release run failed at the PyPI upload step because twine rejected dist/SHA256SUMS as an invalid distribution. The underlying issue: pypa/gh-action-pypi-publish uploads every file in dist/ via `twine upload dist/*`, but our bundle script wrote installer.py + .sha256 + .buildinfo.json + SHA256SUMS into dist/ alongside the wheel + sdist. All non-{whl,tar.gz} entries trip twine's distribution validator. Fix: dist/ stays strict (only .whl + .tar.gz). The single-file installer.py bundle + its sidecars + SHA256SUMS move to a new bundle/ dir. Order also reshuffled so SHA256SUMS is computed AFTER PyPI upload — keeps dist/ pristine through the twine call. Also adds an explicit `rm -rf dist/__pycache__` after `python -m build` as a belt-and-suspenders measure (some build backends leave caches behind). The GitHub release attachments still reference the same five files; only their source dirs change.
1 parent 9f62b5f commit 4896512

1 file changed

Lines changed: 16 additions & 12 deletions

File tree

.github/workflows/release.yml

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,25 +26,29 @@ jobs:
2626
run: |
2727
python -m pip install --upgrade pip build
2828
python -m build
29+
# Remove dist/__pycache__/ if `python -m build` left one;
30+
# twine treats every file in dist/ as a distribution and
31+
# chokes on non-wheel/sdist entries.
32+
rm -rf dist/__pycache__
2933
30-
- name: Build single-file bundle
31-
run: python scripts/bundle.py --check
34+
- name: Upload to PyPI (only whl + sdist)
35+
uses: pypa/gh-action-pypi-publish@release/v1
36+
# At this point dist/ contains exactly *.whl + *.tar.gz. The
37+
# bundle + checksum file are written to bundle/ in the next
38+
# step so twine doesn't try to upload them.
3239

33-
- name: Compute checksums
40+
- name: Build single-file bundle (into separate `bundle/` dir)
3441
run: |
35-
# `python -m build` leaves dist/__pycache__/ which trips
36-
# `shasum dist/*`. Hash only release artifacts.
37-
(cd dist && shasum -a 256 *.whl *.tar.gz installer.py > SHA256SUMS)
38-
39-
- name: Upload to PyPI
40-
uses: pypa/gh-action-pypi-publish@release/v1
42+
python scripts/bundle.py --output bundle/installer.py --check
43+
shasum -a 256 dist/*.whl dist/*.tar.gz bundle/installer.py \
44+
> bundle/SHA256SUMS
4145
4246
- name: Attach bundle + checksums to GitHub Release
4347
uses: softprops/action-gh-release@v2
4448
with:
4549
files: |
46-
dist/installer.py
47-
dist/installer.py.sha256
50+
bundle/installer.py
51+
bundle/installer.py.sha256
52+
bundle/SHA256SUMS
4853
dist/get_installer-*.whl
4954
dist/get_installer-*.tar.gz
50-
dist/SHA256SUMS

0 commit comments

Comments
 (0)