Skip to content

Commit 7a389af

Browse files
committed
trying a more deterministic approach to package version verification
1 parent 923f9cc commit 7a389af

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

.github/workflows/pr-preview.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,25 +103,28 @@ jobs:
103103
env:
104104
VERSION: ${{ env.VERSION }}
105105
run: |
106-
# Wait for package to be available (try up to 30 times with 20s delay - total 10 minutes)
107106
for i in {1..30}; do
108-
if curl -s -f https://test.pypi.org/pypi/socketsecurity/$VERSION/json > /dev/null; then
109-
echo "Package ${VERSION} is now available on Test PyPI"
107+
if pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple socketsecurity==${VERSION}; then
108+
echo "Package ${VERSION} is now available and installable on Test PyPI"
109+
pip uninstall -y socketsecurity
110+
echo "success=true" >> $GITHUB_OUTPUT
110111
exit 0
111112
fi
112-
echo "Attempt $i: Package not yet available, waiting 20s... (${i}/30)"
113+
echo "Attempt $i: Package not yet installable, waiting 20s... (${i}/30)"
113114
sleep 20
114115
done
115-
echo "Package ${VERSION} not available after 10 minutes"
116+
echo "success=false" >> $GITHUB_OUTPUT
116117
exit 1
117118
118119
- name: Login to Docker Hub
120+
if: steps.verify_package.outputs.success == 'true'
119121
uses: docker/login-action@v3
120122
with:
121123
username: ${{ secrets.DOCKERHUB_USERNAME }}
122124
password: ${{ secrets.DOCKERHUB_TOKEN }}
123125

124126
- name: Build & Push Docker Preview
127+
if: steps.verify_package.outputs.success == 'true'
125128
uses: docker/build-push-action@v5
126129
env:
127130
VERSION: ${{ env.VERSION }}

0 commit comments

Comments
 (0)