Skip to content

Commit d415c0e

Browse files
authored
Merge pull request #132 from Huelse/pypi
publish to pypi
2 parents 2a56a5e + 8ebd0db commit d415c0e

1 file changed

Lines changed: 39 additions & 0 deletions

File tree

.github/workflows/wheels.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,11 @@ jobs:
9494
permissions:
9595
id-token: write
9696
steps:
97+
- name: Set up Python
98+
uses: actions/setup-python@v5
99+
with:
100+
python-version: "3.12"
101+
97102
- name: Download wheel artifacts
98103
uses: actions/download-artifact@v4
99104
with:
@@ -107,5 +112,39 @@ jobs:
107112
path: dist
108113
name: sdist
109114

115+
- name: Validate distribution archives
116+
run: |
117+
python -m pip install --upgrade pip twine
118+
python - <<'PY'
119+
import glob
120+
import zipfile
121+
import sys
122+
123+
wheels = sorted(glob.glob("dist/**/*.whl", recursive=True))
124+
if not wheels:
125+
print("No wheel files found under dist/")
126+
sys.exit(1)
127+
128+
bad = []
129+
for whl in wheels:
130+
try:
131+
with zipfile.ZipFile(whl) as zf:
132+
zf.testzip()
133+
except Exception as exc:
134+
bad.append((whl, repr(exc)))
135+
136+
if bad:
137+
print("Corrupted wheel(s) detected:")
138+
for p, e in bad:
139+
print(f" - {p}: {e}")
140+
sys.exit(1)
141+
142+
print("All wheels passed ZIP integrity check.")
143+
PY
144+
find dist -type f \( -name "*.whl" -o -name "*.tar.gz" \) -print
145+
python -m twine check $(find dist -type f \( -name "*.whl" -o -name "*.tar.gz" \))
146+
110147
- name: Publish package distributions to PyPI
111148
uses: pypa/gh-action-pypi-publish@release/v1
149+
with:
150+
packages-dir: dist

0 commit comments

Comments
 (0)