From eb7a9aa34de6d5a9ebfd0861072ad531ef38baec Mon Sep 17 00:00:00 2001 From: Alexis BRENON Date: Fri, 11 Oct 2024 10:49:58 +0200 Subject: [PATCH] ci(python): improve pypi package availability check (#14) --- .github/workflows/image.yaml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/image.yaml b/.github/workflows/image.yaml index bebbce6..ad7e66f 100644 --- a/.github/workflows/image.yaml +++ b/.github/workflows/image.yaml @@ -62,16 +62,17 @@ jobs: - name: Wait for package availability if: ${{ github.event_name == 'push' }} run: | - bash -c ' + bash -xc ' try=10 while [ "$try" -gt 0 ]; do sleep 5 - curl https://${{ github.ref_type != 'tag' && 'test.' || '' }}pypi.org/simple/greenbids-tailor/ | grep -q greenbids_tailor-${{ inputs.app-version }} && exit 0 + url="$(curl https://${{ github.ref_type != 'tag' && 'test.' || '' }}pypi.org/simple/greenbids-tailor/ | grep greenbids_tailor-${{ inputs.app-version }} | sed -Ee 's/.*href="([^"]+)".*/\1/')" + if [ "$url" ]; then + curl -I "$url" | grep -q -E '^HTTP.*200' && exit 0 try=$(( try - 1 )) done exit 1 ' - sleep 5 - name: Build and push Docker image id: push