From d14dcc772608db8d0ca66299eaef207a47e550c3 Mon Sep 17 00:00:00 2001 From: Eric Hibbs Date: Wed, 6 Nov 2024 15:30:38 -0800 Subject: [PATCH] querying pypi metadata directly --- .github/workflows/pr-preview.yml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/pr-preview.yml b/.github/workflows/pr-preview.yml index 6bea8b3..b1fb537 100644 --- a/.github/workflows/pr-preview.yml +++ b/.github/workflows/pr-preview.yml @@ -30,9 +30,8 @@ jobs: - name: Check if version exists on Test PyPI id: version_check run: | - # Try both exact version check and pip install dry-run - if pip download --no-deps --dry-run --index-url https://test.pypi.org/simple/ "socketsecurity==${VERSION}" 2>/dev/null; then - echo "Version ${VERSION} already exists on Test PyPI (found via pip download)" + if curl -s https://test.pypi.org/pypi/socketsecurity/$VERSION/json | grep -q '"version": "'$VERSION'"'; then + echo "Version ${VERSION} already exists on Test PyPI" echo "exists=true" >> $GITHUB_OUTPUT else echo "Version ${VERSION} not found on Test PyPI" @@ -100,14 +99,14 @@ jobs: if: steps.version_check.outputs.exists != 'true' id: verify_package run: | - # Wait for package to be available (try up to 5 times with 30s delay) + # Wait for package to be available (try up to 5 times with 10s delay) for i in {1..5}; do - if pip download --no-deps --dry-run --index-url https://test.pypi.org/simple/ "socketsecurity==${VERSION}" 2>/dev/null; then + if curl -s https://test.pypi.org/pypi/socketsecurity/$VERSION/json | grep -q '"version": "'$VERSION'"'; then echo "Package ${VERSION} is now available on Test PyPI" exit 0 fi - echo "Attempt $i: Package not yet available, waiting 30s..." - sleep 30 + echo "Attempt $i: Package not yet available, waiting 10s..." + sleep 10 done echo "Package ${VERSION} not available after 5 attempts" exit 1