Skip to content

Commit 6552ddc

Browse files
authored
Update publish.yml
1 parent 52eee00 commit 6552ddc

1 file changed

Lines changed: 14 additions & 4 deletions

File tree

.github/workflows/publish.yml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,24 @@ jobs:
3434
python -m pip install --upgrade pip
3535
pip install build twine toml
3636
37-
- name: Verify package version
37+
- name: Verify package version
3838
run: |
3939
PACKAGE_VERSION=$(python -c "import toml; print(toml.load(open('pyproject.toml'))['project']['version'])")
40+
RELEASE_TAG_NAME="${{ github.ref_name }}" # e.g., v1.0.12
41+
42+
# --- THE CRUCIAL FIX IS HERE ---
43+
# Strip 'v' prefix from the release tag name for comparison
44+
CLEAN_RELEASE_VERSION=$(echo "$RELEASE_TAG_NAME" | sed 's/^v//')
45+
# --- END OF FIX ---
46+
4047
echo "Detected version from pyproject.toml: $PACKAGE_VERSION"
41-
echo "Expected tag version: ${{ github.ref_name }}"
42-
if [ "$PACKAGE_VERSION" != "${{ github.ref_name }}" ]; then
43-
echo "Error: The version in pyproject.toml does not match the release tag."
48+
echo "Expected cleaned tag version: $CLEAN_RELEASE_VERSION (from tag: $RELEASE_TAG_NAME)"
49+
50+
if [ "$PACKAGE_VERSION" != "$CLEAN_RELEASE_VERSION" ]; then
51+
echo "Error: The version in pyproject.toml ($PACKAGE_VERSION) does not match the cleaned release tag ($CLEAN_RELEASE_VERSION)."
4452
exit 1
53+
else
54+
echo "Version match confirmed: $PACKAGE_VERSION == $CLEAN_RELEASE_VERSION"
4555
fi
4656
4757
- name: Clean old builds and build new package

0 commit comments

Comments
 (0)