2222
2323if [[ $# -lt 2 ]]; then
2424 echo " Usage: $0 \$ VERSION \$ WORKFLOW_ID"
25+ echo " Example: $0 3.12.0-candidate-0 25781230226"
2526 exit 1
2627fi
2728if [[ ! $GITHUB_TOKEN ]]; then
@@ -34,20 +35,45 @@ TAG=v$VERSION
3435WORKFLOW_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
4042VERSION=$( echo $VERSION | sed ' s/-candidate-.*//' )
4143mv $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
5278done
5379
0 commit comments