2727 REF_NAME : ${{ github.ref_name }}
2828 run : |
2929 RAW_VERSION=$(hatch version)
30- echo "VERSION=$RAW_VERSION" >> $GITHUB_ENV
30+ echo "VERSION=$RAW_VERSION" >> " $GITHUB_ENV"
3131 if [ "v$RAW_VERSION" != "$REF_NAME" ]; then
3232 echo "Error: Git tag ($REF_NAME) does not match hatch version (v$RAW_VERSION)"
3333 exit 1
@@ -38,12 +38,12 @@ jobs:
3838 env :
3939 VERSION : ${{ env.VERSION }}
4040 run : |
41- if curl -s -f https://pypi.org/pypi/socketdev/$VERSION/json > /dev/null; then
41+ if curl -s -f " https://pypi.org/pypi/socketdev/$VERSION/json" > /dev/null; then
4242 echo "Version ${VERSION} already exists on PyPI"
43- echo "pypi_exists=true" >> $GITHUB_OUTPUT
43+ echo "pypi_exists=true" >> " $GITHUB_OUTPUT"
4444 else
4545 echo "Version ${VERSION} not found on PyPI - proceeding with PyPI deployment"
46- echo "pypi_exists=false" >> $GITHUB_OUTPUT
46+ echo "pypi_exists=false" >> " $GITHUB_OUTPUT"
4747 fi
4848
4949 - name : Build package
@@ -60,15 +60,24 @@ jobs:
6060 env :
6161 VERSION : ${{ env.VERSION }}
6262 run : |
63- for i in {1..30}; do
64- if pip install socketdev==${VERSION}; then
63+ # The first lookup can race PyPI's Simple-index propagation. pip caches HTTP
64+ # responses by default, so without --no-cache-dir every retry can reuse that
65+ # initial stale response instead of checking whether the release has appeared.
66+ MAX_ATTEMPTS=40
67+ for i in $(seq 1 "$MAX_ATTEMPTS"); do
68+ if python -m pip install \
69+ --no-cache-dir \
70+ --index-url https://pypi.org/simple/ \
71+ "socketdev==${VERSION}"; then
6572 echo "Package ${VERSION} is now available and installable on PyPI"
66- pip uninstall -y socketdev
67- echo "success=true" >> $GITHUB_OUTPUT
73+ python -m pip uninstall -y socketdev
74+ echo "success=true" >> " $GITHUB_OUTPUT"
6875 exit 0
6976 fi
70- echo "Attempt $i: Package not yet installable, waiting 20s... (${i}/30)"
71- sleep 20
77+ if [ "$i" -lt "$MAX_ATTEMPTS" ]; then
78+ echo "Attempt $i: Package not yet installable, waiting 20s... (${i}/${MAX_ATTEMPTS})"
79+ sleep 20
80+ fi
7281 done
73- echo "success=false" >> $GITHUB_OUTPUT
82+ echo "success=false" >> " $GITHUB_OUTPUT"
7483 exit 1
0 commit comments