From ddbbea2867b4e6f9ef97af07f95cdcabc6ba4fb5 Mon Sep 17 00:00:00 2001 From: Fiona Kilfoyle Date: Mon, 12 Oct 2026 12:11:04 +0200 Subject: [PATCH] Fix PyPI publish for metadata 2.5 and allow retrying a release - Bump pypa/gh-action-pypi-publish v1.14.0 -> v1.14.2. Its twine 6.1 rejected the Metadata-Version 2.5 that current hatchling writes, which failed the 2.0.0 publish. v1.14.2 ships twine 7. - Add workflow_dispatch so a failed release can be retried; manual runs skip the version-changed check and rely on the existing-release check. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/python-release.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/python-release.yml b/.github/workflows/python-release.yml index ad6fb2c..3f84904 100644 --- a/.github/workflows/python-release.yml +++ b/.github/workflows/python-release.yml @@ -5,6 +5,9 @@ on: branches: ["main", "master"] paths: - "CHANGELOG.md" + # Retry a release whose publish failed; the existing-release check below + # still prevents publishing the same version twice. + workflow_dispatch: permissions: {} @@ -56,8 +59,14 @@ jobs: id: version-changed env: BEFORE_SHA: ${{ github.event.before }} + EVENT_NAME: ${{ github.event_name }} VERSION: ${{ steps.release.outputs.version }} run: | + # Manual runs have no "before" commit; rely on the existing-release check. + if [ "${EVENT_NAME}" = "workflow_dispatch" ]; then + echo "changed=true" >> "$GITHUB_OUTPUT" + exit 0 + fi previous_version=$(git show "${BEFORE_SHA}:pyproject.toml" | python -c ' import sys import tomllib @@ -119,7 +128,7 @@ jobs: - name: Publish package if: steps.version-changed.outputs.changed == 'true' && steps.existing-release.outputs.exists == 'false' - uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0 + uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2 with: user: __token__ password: ${{ secrets.pypi_password }}