diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index d3c536f..c1f5315 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,6 +1,9 @@ name: Publish to PyPI on: + push: + tags: + - 'v*.*.*' release: types: [published] workflow_dispatch: @@ -23,6 +26,16 @@ jobs: steps: - uses: actions/checkout@v7 + - name: Verify tag matches pyproject.toml version + if: github.event_name == 'push' + run: | + TAG=${GITHUB_REF#refs/tags/v} + PYPROJECT_VERSION=$(grep '^version = ' pyproject.toml | cut -d'"' -f2) + if [ "${TAG}" != "${PYPROJECT_VERSION}" ]; then + echo "Error: Tag version (${TAG}) does not match pyproject.toml version (${PYPROJECT_VERSION})" + exit 1 + fi + - name: Install uv uses: astral-sh/setup-uv@v8.3.2 with: