Skip to content

Commit 38c117d

Browse files
authored
Merge pull request #100 from blues/alex-add-version-match
feat: add a version match for git release and pypi
2 parents 77710dd + bc1a0a6 commit 38c117d

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

.github/workflows/python-publish.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,18 @@ jobs:
2121
run: |
2222
python -m pip install --upgrade pip
2323
pip install build twine
24+
- name: Check version matches
25+
run: |
26+
# Extract version from pyproject.toml using Python
27+
PACKAGE_VERSION=$(python -c "import tomli; print(tomli.loads(open('pyproject.toml', 'rb').read().decode('utf-8'))['project']['version'])")
28+
# Extract version from git tag (remove 'v' prefix)
29+
GIT_TAG_VERSION=${GITHUB_REF#refs/tags/v}
30+
# Compare versions
31+
if [ "$PACKAGE_VERSION" != "$GIT_TAG_VERSION" ]; then
32+
echo "Error: Version mismatch between pyproject.toml ($PACKAGE_VERSION) and git tag ($GIT_TAG_VERSION)"
33+
exit 1
34+
fi
35+
echo "Version check passed: $PACKAGE_VERSION"
2436
- name: Build and publish
2537
env:
2638
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "note-python"
7-
version = "1.5.2"
7+
version = "1.5.4"
88
description = "Cross-platform Python Library for the Blues Wireless Notecard"
99
authors = [
1010
{name = "Blues Inc.", email = "[email protected]"},

0 commit comments

Comments
 (0)