diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index 47cb1a6..7ca84ab 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -21,6 +21,18 @@ jobs: run: | python -m pip install --upgrade pip pip install build twine + - name: Check version matches + run: | + # Extract version from pyproject.toml using Python + PACKAGE_VERSION=$(python -c "import tomli; print(tomli.loads(open('pyproject.toml', 'rb').read().decode('utf-8'))['project']['version'])") + # Extract version from git tag (remove 'v' prefix) + GIT_TAG_VERSION=${GITHUB_REF#refs/tags/v} + # Compare versions + if [ "$PACKAGE_VERSION" != "$GIT_TAG_VERSION" ]; then + echo "Error: Version mismatch between pyproject.toml ($PACKAGE_VERSION) and git tag ($GIT_TAG_VERSION)" + exit 1 + fi + echo "Version check passed: $PACKAGE_VERSION" - name: Build and publish env: TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} diff --git a/pyproject.toml b/pyproject.toml index 254cd34..a425414 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "note-python" -version = "1.5.2" +version = "1.5.4" description = "Cross-platform Python Library for the Blues Wireless Notecard" authors = [ {name = "Blues Inc.", email = "support@blues.com"},