Skip to content

Commit c0fca78

Browse files
committed
Enhance PyPI availability check in CI workflow with additional methods and increase wait time
1 parent fb7495c commit c0fca78

1 file changed

Lines changed: 21 additions & 7 deletions

File tree

.github/workflows/cd.yml

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,17 +57,31 @@ jobs:
5757
echo "Waiting for PyPI package to be available..."
5858
PACKAGE_NAME="access_mopper"
5959
VERSION=$(python -c "import versioneer; print(versioneer.get_version())")
60+
# Strip 'v' prefix if present (git tags often have 'v' but PyPI versions don't)
61+
VERSION=${VERSION#v}
6062
echo "Looking for package: ${PACKAGE_NAME}==${VERSION}"
6163
62-
# Wait up to 10 minutes for the package to be available
63-
for i in {1..60}; do
64-
echo "Attempt $i/60: Checking PyPI availability..."
65-
if pip index versions ${PACKAGE_NAME} 2>/dev/null | grep -q "${VERSION}"; then
66-
echo "✅ Package ${PACKAGE_NAME}==${VERSION} is available on PyPI!"
64+
# Wait up to 15 minutes for the package to be available
65+
for i in {1..90}; do
66+
echo "Attempt $i/90: Checking PyPI availability..."
67+
68+
# Try multiple methods to check package availability
69+
# Method 1: Check PyPI JSON API
70+
if curl -s "https://pypi.org/pypi/${PACKAGE_NAME}/json" | grep -q "\"${VERSION}\""; then
71+
echo "✅ Package ${PACKAGE_NAME}==${VERSION} found via PyPI API!"
6772
break
6873
fi
69-
if [ $i -eq 60 ]; then
70-
echo "❌ Package not found on PyPI after 10 minutes"
74+
75+
# Method 2: Try pip install --dry-run (fallback)
76+
if pip install --dry-run ${PACKAGE_NAME}==${VERSION} >/dev/null 2>&1; then
77+
echo "✅ Package ${PACKAGE_NAME}==${VERSION} is installable!"
78+
break
79+
fi
80+
81+
if [ $i -eq 90 ]; then
82+
echo "❌ Package not found on PyPI after 15 minutes"
83+
echo "Available versions:"
84+
curl -s "https://pypi.org/pypi/${PACKAGE_NAME}/json" | grep -o '"[0-9][^"]*"' | head -10 || echo "Could not fetch versions"
7185
exit 1
7286
fi
7387
echo "Package not yet available, waiting 10 seconds..."

0 commit comments

Comments
 (0)