Skip to content

Commit af11e61

Browse files
committed
Harden release: twine metadata check with pinned modern tooling
Add a check_metadata job that runs 'twine check --strict' over the built wheels + sdist before publishing, with pinned twine>=6.1 / packaging>=24.2 so PEP 639 License-Expression (Metadata 2.4) validates regardless of any stale system 'packaging'. publish_testpypi and publish_pypi now gate on it.
1 parent 87976f9 commit af11e61

1 file changed

Lines changed: 20 additions & 2 deletions

File tree

.github/workflows/release.yml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,26 @@ jobs:
8080
name: sdist
8181
path: dist/*.tar.gz
8282

83-
publish_testpypi:
83+
check_metadata:
8484
needs: [build_wheels, build_sdist]
85+
runs-on: ubuntu-latest
86+
steps:
87+
- uses: actions/download-artifact@v4
88+
with:
89+
path: dist
90+
merge-multiple: true
91+
- uses: actions/setup-python@v5
92+
with:
93+
python-version: "3.11"
94+
- name: Validate metadata and README rendering (twine check)
95+
run: |
96+
# Pin modern tooling so PEP 639 License-Expression / Metadata 2.4 is
97+
# recognized regardless of any preinstalled system 'packaging'.
98+
python -m pip install -U pip "twine>=6.1" "packaging>=24.2"
99+
python -m twine check --strict dist/*
100+
101+
publish_testpypi:
102+
needs: [build_wheels, build_sdist, check_metadata]
85103
if: github.event_name == 'workflow_dispatch' && inputs.publish == 'testpypi'
86104
runs-on: ubuntu-latest
87105
environment: testpypi
@@ -97,7 +115,7 @@ jobs:
97115
repository-url: https://test.pypi.org/legacy/
98116

99117
publish_pypi:
100-
needs: [build_wheels, build_sdist]
118+
needs: [build_wheels, build_sdist, check_metadata]
101119
if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.publish == 'pypi')
102120
runs-on: ubuntu-latest
103121
environment: pypi

0 commit comments

Comments
 (0)