Skip to content

Commit 5527f41

Browse files
Fix some wheels not downloaded from stage-release.sh (#301)
1 parent 914dea7 commit 5527f41

1 file changed

Lines changed: 34 additions & 8 deletions

File tree

build-support/stage-release.sh

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ set -e
2222

2323
if [[ $# -lt 2 ]]; then
2424
echo "Usage: $0 \$VERSION \$WORKFLOW_ID"
25+
echo "Example: $0 3.12.0-candidate-0 25781230226"
2526
exit 1
2627
fi
2728
if [[ ! $GITHUB_TOKEN ]]; then
@@ -34,20 +35,45 @@ TAG=v$VERSION
3435
WORKFLOW_ID=$2
3536

3637
# Download the source tar
37-
curl -O -L https://github.com/apache/pulsar-client-python/archive/refs/tags/$TAG.tar.gz
38+
curl --fail --location --remote-name \
39+
https://github.com/apache/pulsar-client-python/archive/refs/tags/$TAG.tar.gz
3840

3941
# Remove the "-candidate-N" suffix
4042
VERSION=$(echo $VERSION | sed 's/-candidate-.*//')
4143
mv $TAG.tar.gz pulsar-client-python-$VERSION.tar.gz
4244

4345
# Download the Python wheels
44-
URLS=$(curl -L https://api.github.com/repos/apache/pulsar-client-python/actions/runs/$WORKFLOW_ID/artifacts \
45-
| jq -r '.artifacts[]
46-
| select(((.name // "") | contains("dockerbuild")) | not)
47-
| .archive_download_url')
48-
for URL in $URLS; do
49-
curl -O -L "$URL" -H "Accept: application/vnd.github+json" -H "Authorization: Bearer $GITHUB_TOKEN"
50-
unzip -q zip
46+
ARTIFACTS_API=https://api.github.com/repos/apache/pulsar-client-python/actions/runs/$WORKFLOW_ID/artifacts
47+
URLS=()
48+
PAGE=1
49+
while true; do
50+
RESPONSE=$(curl --fail --silent --show-error --location \
51+
-H "Accept: application/vnd.github+json" \
52+
-H "Authorization: Bearer $GITHUB_TOKEN" \
53+
"$ARTIFACTS_API?per_page=100&page=$PAGE")
54+
while IFS= read -r URL; do
55+
[[ -n $URL ]] && URLS+=("$URL")
56+
done < <(jq -r '.artifacts[]
57+
| select(((.name // "") | contains("dockerbuild")) | not)
58+
| .archive_download_url' <<< "$RESPONSE")
59+
60+
if [[ $(jq '.artifacts | length' <<< "$RESPONSE") -lt 100 ]]; then
61+
break
62+
fi
63+
PAGE=$((PAGE + 1))
64+
done
65+
66+
if [[ ${#URLS[@]} -eq 0 ]]; then
67+
echo "No wheel artifacts found for workflow run $WORKFLOW_ID"
68+
exit 3
69+
fi
70+
71+
for URL in "${URLS[@]}"; do
72+
curl --fail --location --output zip \
73+
-H "Accept: application/vnd.github+json" \
74+
-H "Authorization: Bearer $GITHUB_TOKEN" \
75+
"$URL"
76+
unzip -oq zip
5177
rm -f zip
5278
done
5379

0 commit comments

Comments
 (0)