Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@ jobs:
VERSION="${{ steps.meta.outputs.version }}"
echo "Waiting for gemstack $VERSION on PyPI..."
for i in $(seq 1 30); do
if curl -sf "https://pypi.org/pypi/gemstack/$VERSION/json" > /dev/null 2>&1; then
echo "✅ Package available on PyPI"
exit 0
if curl -sf "https://pypi.org/pypi/gemstack/$VERSION/json" > pypi.json; then
if python3 -c "import sys,json; data=json.load(open('pypi.json')); sys.exit(0 if any(u['packagetype']=='sdist' for u in data.get('urls', [])) else 1)" 2>/dev/null; then
echo "✅ Package and sdist available on PyPI"
exit 0
fi
fi
echo " Attempt $i/30 — waiting 10s..."
sleep 10
Expand All @@ -45,16 +47,14 @@ jobs:
run: |
VERSION="${{ steps.meta.outputs.version }}"
mkdir -p dist/
# Fetch PyPI metadata once and extract both URLs
PYPI_JSON=$(curl -sf "https://pypi.org/pypi/gemstack/$VERSION/json")
if [ -z "$PYPI_JSON" ]; then
# Fetch PyPI metadata and extract both URLs
curl -sf "https://pypi.org/pypi/gemstack/$VERSION/json" > pypi.json
if [ ! -s pypi.json ]; then
echo "::error::Failed to fetch PyPI metadata for gemstack $VERSION"
exit 1
fi
WHEEL_URL=$(echo "$PYPI_JSON" \
| python3 -c "import sys,json; urls=json.load(sys.stdin)['urls']; print(next(u['url'] for u in urls if u['packagetype']=='bdist_wheel'))")
SDIST_URL=$(echo "$PYPI_JSON" \
| python3 -c "import sys,json; urls=json.load(sys.stdin)['urls']; print(next(u['url'] for u in urls if u['packagetype']=='sdist'))")
WHEEL_URL=$(python3 -c "import sys,json; urls=json.load(open('pypi.json'))['urls']; print(next(u['url'] for u in urls if u['packagetype']=='bdist_wheel'))")
SDIST_URL=$(python3 -c "import sys,json; urls=json.load(open('pypi.json'))['urls']; print(next(u['url'] for u in urls if u['packagetype']=='sdist'))")
curl -fSL "$WHEEL_URL" -o "dist/gemstack-${VERSION}-py3-none-any.whl"
curl -fSL "$SDIST_URL" -o "dist/gemstack-${VERSION}.tar.gz"
ls -lh dist/
Expand Down
16 changes: 9 additions & 7 deletions .github/workflows/update-formula.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@ jobs:
VERSION="${{ steps.version.outputs.version }}"
echo "Waiting for gemstack $VERSION on PyPI..."
for i in $(seq 1 30); do
if curl -sf "https://pypi.org/pypi/gemstack/$VERSION/json" > /dev/null 2>&1; then
echo "Package available on PyPI"
exit 0
if curl -sf "https://pypi.org/pypi/gemstack/$VERSION/json" > pypi.json; then
if python3 -c "import sys,json; data=json.load(open('pypi.json')); sys.exit(0 if any(u['packagetype']=='sdist' for u in data.get('urls', [])) else 1)" 2>/dev/null; then
echo "✅ Package and sdist available on PyPI"
exit 0
fi
fi
echo "Attempt $i/30 — waiting 10s..."
echo " Attempt $i/30 — waiting 10s..."
sleep 10
done
echo "::error::Package not found on PyPI after 5 minutes"
Expand All @@ -40,9 +42,9 @@ jobs:
id: sha
run: |
VERSION="${{ steps.version.outputs.version }}"
# Fetch PyPI metadata once and reuse
PYPI_JSON=$(curl -sf "https://pypi.org/pypi/gemstack/$VERSION/json")
URL=$(echo "$PYPI_JSON" | python3 -c "import sys,json; urls=json.load(sys.stdin)['urls']; print(next(u['url'] for u in urls if u['packagetype']=='sdist'))")
# Fetch PyPI metadata
curl -sf "https://pypi.org/pypi/gemstack/$VERSION/json" > pypi.json
URL=$(python3 -c "import sys,json; urls=json.load(open('pypi.json'))['urls']; print(next(u['url'] for u in urls if u['packagetype']=='sdist'))")
echo "Downloading $URL"
curl -fSL "$URL" -o gemstack.tar.gz
SHA256=$(sha256sum gemstack.tar.gz | cut -d' ' -f1)
Expand Down
Loading