From f533a3d37749d6da0174fa41d2dead34f4157d8a Mon Sep 17 00:00:00 2001 From: Franco Garcia Date: Tue, 13 Oct 2026 17:57:31 -0300 Subject: [PATCH] Fail the publish build when LICENSE is not packaged Check that the wheel and sdist carry LICENSE before anything reaches PyPI (CLO-5133). --- .github/workflows/pypi-publish.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/workflows/pypi-publish.yml b/.github/workflows/pypi-publish.yml index 2f44920..4fe8b85 100644 --- a/.github/workflows/pypi-publish.yml +++ b/.github/workflows/pypi-publish.yml @@ -52,6 +52,22 @@ jobs: - name: Check package run: twine check dist/* + - name: Check LICENSE is packaged + shell: python + run: | + import glob, sys, tarfile, zipfile + + missing = [] + for whl in glob.glob("dist/*.whl"): + if not any(n.endswith(".dist-info/licenses/LICENSE") for n in zipfile.ZipFile(whl).namelist()): + missing.append(whl) + for sdist in glob.glob("dist/*.tar.gz"): + if not any(n.count("/") == 1 and n.endswith("/LICENSE") for n in tarfile.open(sdist).getnames()): + missing.append(sdist) + for path in missing: + print(f"::error::{path} does not include LICENSE") + sys.exit(1 if missing else 0) + - name: Verify tag matches version if: github.event_name == 'push' run: |