diff --git a/.github/actions/build-packages/action.yaml b/.github/actions/build-packages/action.yaml new file mode 100644 index 00000000..97341577 --- /dev/null +++ b/.github/actions/build-packages/action.yaml @@ -0,0 +1,14 @@ +name: Build Packages +description: Build the release packages into dist/ and verify their metadata +runs: + using: composite + steps: + - name: Build Packages + id: build-packages + shell: bash + run: uv build --build-constraints .github/build-constraints.txt + + - name: Check Packages + id: check-packages + shell: bash + run: uvx --with packaging==26.2 twine==7.0.0 check --strict dist/* diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7a54874d..f20afb1e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,6 +45,11 @@ jobs: run: | uv run pre-commit run --all-files --verbose + # Build the same way as publish.yml to catch packaging issues before a release is tagged. + - name: Build and Check Packages + id: build-packages + uses: ./.github/actions/build-packages + tests: name: Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} needs: lint diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index fc94377c..b0979e3c 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -26,11 +26,13 @@ jobs: version-file: uv.lock python-version: ${{ env.PYTHON_VERSION }} - - name: Build Packages + - name: Build and Check Packages id: build-packages - shell: bash - run: uv build --build-constraints .github/build-constraints.txt + uses: ./.github/actions/build-packages - name: Publish Release on PyPI id: publish-release-on-pypi uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2 + with: + # Metadata is already verified by the build action, same as in CI. + verify-metadata: false