Skip to content

Commit

Permalink
trying a more deterministic approach to package version verification
Browse files Browse the repository at this point in the history
  • Loading branch information
flowstate committed Nov 7, 2024
1 parent 923f9cc commit 7a389af
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions .github/workflows/pr-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,25 +103,28 @@ jobs:
env:
VERSION: ${{ env.VERSION }}
run: |
# Wait for package to be available (try up to 30 times with 20s delay - total 10 minutes)
for i in {1..30}; do
if curl -s -f https://test.pypi.org/pypi/socketsecurity/$VERSION/json > /dev/null; then
echo "Package ${VERSION} is now available on Test PyPI"
if pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple socketsecurity==${VERSION}; then
echo "Package ${VERSION} is now available and installable on Test PyPI"
pip uninstall -y socketsecurity
echo "success=true" >> $GITHUB_OUTPUT
exit 0
fi
echo "Attempt $i: Package not yet available, waiting 20s... (${i}/30)"
echo "Attempt $i: Package not yet installable, waiting 20s... (${i}/30)"
sleep 20
done
echo "Package ${VERSION} not available after 10 minutes"
echo "success=false" >> $GITHUB_OUTPUT
exit 1
- name: Login to Docker Hub
if: steps.verify_package.outputs.success == 'true'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build & Push Docker Preview
if: steps.verify_package.outputs.success == 'true'
uses: docker/build-push-action@v5
env:
VERSION: ${{ env.VERSION }}
Expand Down

0 comments on commit 7a389af

Please sign in to comment.