Skip to content

Commit d7896ed

Browse files
committed
ci: retry release artifact downloads
1 parent f6de2b3 commit d7896ed

2 files changed

Lines changed: 40 additions & 16 deletions

File tree

.github/workflows/openclaw-npm-release.yml

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -511,10 +511,25 @@ jobs:
511511
preferred_name="openclaw-npm-preflight-${RELEASE_TAG}"
512512
rm -rf preflight-tarball
513513
mkdir -p preflight-tarball
514-
if gh run download "${PREFLIGHT_RUN_ID}" \
515-
--repo "${GITHUB_REPOSITORY}" \
516-
--name "${preferred_name}" \
517-
--dir preflight-tarball; then
514+
515+
download_named_artifact() {
516+
local artifact_name="$1"
517+
for attempt in 1 2 3; do
518+
if gh run download "${PREFLIGHT_RUN_ID}" \
519+
--repo "${GITHUB_REPOSITORY}" \
520+
--name "${artifact_name}" \
521+
--dir preflight-tarball; then
522+
return 0
523+
fi
524+
if [[ "$attempt" != "3" ]]; then
525+
echo "::warning::Artifact download for ${artifact_name} failed on attempt ${attempt}; retrying."
526+
sleep $((attempt * 10))
527+
fi
528+
done
529+
return 1
530+
}
531+
532+
if download_named_artifact "${preferred_name}"; then
518533
echo "Downloaded ${preferred_name}."
519534
return 0
520535
fi
@@ -530,10 +545,7 @@ jobs:
530545
exit 1
531546
fi
532547
fallback_name="${matches[0]}"
533-
gh run download "${PREFLIGHT_RUN_ID}" \
534-
--repo "${GITHUB_REPOSITORY}" \
535-
--name "${fallback_name}" \
536-
--dir preflight-tarball
548+
download_named_artifact "${fallback_name}"
537549
echo "Downloaded fallback preflight artifact ${fallback_name}."
538550
}
539551

.github/workflows/openclaw-release-publish.yml

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,25 @@ jobs:
153153
preflight_dir="${RUNNER_TEMP}/openclaw-npm-preflight-manifest"
154154
rm -rf "${preflight_dir}"
155155
mkdir -p "${preflight_dir}"
156-
if gh run download "${PREFLIGHT_RUN_ID}" \
157-
--repo "${GITHUB_REPOSITORY}" \
158-
--name "${preferred_name}" \
159-
--dir "${preflight_dir}"; then
156+
157+
download_named_artifact() {
158+
local artifact_name="$1"
159+
for attempt in 1 2 3; do
160+
if gh run download "${PREFLIGHT_RUN_ID}" \
161+
--repo "${GITHUB_REPOSITORY}" \
162+
--name "${artifact_name}" \
163+
--dir "${preflight_dir}"; then
164+
return 0
165+
fi
166+
if [[ "$attempt" != "3" ]]; then
167+
echo "::warning::Artifact download for ${artifact_name} failed on attempt ${attempt}; retrying."
168+
sleep $((attempt * 10))
169+
fi
170+
done
171+
return 1
172+
}
173+
174+
if download_named_artifact "${preferred_name}"; then
160175
echo "name=${preferred_name}" >> "$GITHUB_OUTPUT"
161176
exit 0
162177
fi
@@ -172,10 +187,7 @@ jobs:
172187
exit 1
173188
fi
174189
fallback_name="${matches[0]}"
175-
gh run download "${PREFLIGHT_RUN_ID}" \
176-
--repo "${GITHUB_REPOSITORY}" \
177-
--name "${fallback_name}" \
178-
--dir "${preflight_dir}"
190+
download_named_artifact "${fallback_name}"
179191
echo "name=${fallback_name}" >> "$GITHUB_OUTPUT"
180192
181193
- name: Download full release validation manifest

0 commit comments

Comments
 (0)