From b8cd03f06fe3811b87b22c019b851b146c9feec4 Mon Sep 17 00:00:00 2001 From: Alain Prasquier Date: Fri, 28 Aug 2026 14:14:38 +0300 Subject: [PATCH] fix: publish wheels with metadata 2.5 without double-bumping hatchling 1.32+ emits Metadata-Version 2.5; pin gh-action-pypi-publish to v1.14.2 and skip bump unless the trigger has a MAJOR/MINOR/PATCH token so v1.5.0 can reach PyPI without becoming 1.6.0. Co-authored-by: Cursor --- .github/workflows/publish-pypi.yml | 19 ++++++++++++++++--- docs/CHANGELOG.md | 4 ++++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml index c429256..18e100f 100644 --- a/.github/workflows/publish-pypi.yml +++ b/.github/workflows/publish-pypi.yml @@ -56,16 +56,28 @@ jobs: if echo "$MSG" | grep -qi '\[MAJOR\]'; then PART="major" elif echo "$MSG" | grep -qi '\[MINOR\]'; then PART="minor" elif echo "$MSG" | grep -qi '\[PATCH\]'; then PART="patch" - else PART="minor" + else + echo "No [MAJOR]/[MINOR]/[PATCH] token — skip bump, publish current version" + echo "part=skip" >> "$GITHUB_OUTPUT" + exit 0 fi echo "Bump type: $PART" echo "part=$PART" >> "$GITHUB_OUTPUT" - - name: Bump version and rotate CHANGELOG + - name: Sync with origin/main run: | git config --global user.name 'github-actions[bot]' git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com' git pull --rebase origin main + + - name: Bump version and rotate CHANGELOG + if: steps.bump-type.outputs.part != 'skip' + run: | + HEAD_MSG="$(git log -1 --format=%s)" + if echo "$HEAD_MSG" | grep -q 'chore(release):'; then + echo "HEAD is already a release commit after pull — skip bump" + exit 0 + fi bump-my-version bump ${{ steps.bump-type.outputs.part }} \ --config-file pyproject.toml \ --verbose @@ -78,9 +90,10 @@ jobs: run: hatch build - name: Publish to PyPI - uses: pypa/gh-action-pypi-publish@ba38be9e461d3875417946c167d0b5f3d385a247 # v1.14.1 + uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2 with: packages-dir: dist/ + skip-existing: true - name: Create or update GitHub release env: diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index a615a38..e19456f 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -12,6 +12,10 @@ All notable changes to this project will be documented in this file. ## [Unreleased] +### Fixed + +- **PyPI publish (Metadata 2.5)** — Pin `pypa/gh-action-pypi-publish` to v1.14.2 so hatchling ≥1.32 wheels upload. Skip version bump unless the triggering commit has `[MAJOR]`/`[MINOR]`/`[PATCH]`. + ## [1.5.0] - 2026-08-28 ### Added