Skip to content

Commit de0131d

Browse files
committed
Fix GitHub Actions PyPI workflow version checking logic
- Fix version existence check to properly parse pip index output - Use word boundary matching in 'Available versions' line - Resolves false positive where workflow blocked publication of new versions - Version 1.1.4 can now be published successfully
1 parent e6069b1 commit de0131d

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

.github/workflows/release-pypi.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,15 @@ jobs:
117117
cd python
118118
PACKAGE_NAME=$(grep '^name = ' pyproject.toml | cut -d'"' -f2)
119119
VERSION=$(grep '^version = ' pyproject.toml | cut -d'"' -f2)
120-
if pip index versions "$PACKAGE_NAME" 2>/dev/null | grep -q "$VERSION"; then
121-
echo "Version $VERSION already exists on PyPI"
120+
echo "Checking if version $VERSION of $PACKAGE_NAME exists on PyPI..."
121+
122+
# Check if version exists on PyPI by looking in the "Available versions" line
123+
if pip index versions "$PACKAGE_NAME" 2>/dev/null | grep "Available versions:" | grep -q "\b$VERSION\b"; then
124+
echo "❌ Version $VERSION already exists on PyPI"
122125
exit 1
126+
else
127+
echo "✅ Version $VERSION is available for publishing"
123128
fi
124-
echo "Version $VERSION is available for publishing"
125129
126130
- name: Publish to Test PyPI (dry run)
127131
if: ${{ github.event.inputs.dry_run == 'true' }}

0 commit comments

Comments
 (0)