|
|
@@ -43,7 +43,6 @@ for src in "$@"; do
|
|
|
done
|
|
|
|
|
|
checksums_path="${DIST_DIR}/${CHECKSUMS_NAME}"
|
|
|
-checksums_backup="${DIST_DIR}/${CHECKSUMS_NAME}.orig"
|
|
|
if ! gh release download "${TAG}" --pattern "${CHECKSUMS_NAME}" --dir "${DIST_DIR}" --clobber; then
|
|
|
echo "Failed to download ${CHECKSUMS_NAME} from release ${TAG}" >&2
|
|
|
exit 1
|
|
|
@@ -52,7 +51,6 @@ if [[ ! -f "${checksums_path}" ]]; then
|
|
|
echo "${CHECKSUMS_NAME} not found after download from release ${TAG}" >&2
|
|
|
exit 1
|
|
|
fi
|
|
|
-cp -f "${checksums_path}" "${checksums_backup}"
|
|
|
|
|
|
update_checksum() {
|
|
|
local file_name="${1}"
|
|
|
@@ -72,17 +70,23 @@ for name in "${names[@]}"; do
|
|
|
upload_paths+=("${DIST_DIR}/${name}")
|
|
|
done
|
|
|
|
|
|
-# Upload binaries first so a failed checksums upload can restore the previous file.
|
|
|
# --clobber overwrites same-named assets (needed if the sign job is re-run).
|
|
|
gh release upload "${TAG}" "${upload_paths[@]}" --clobber
|
|
|
|
|
|
-if ! gh release upload "${TAG}" "${checksums_path}" --clobber; then
|
|
|
- echo "Failed to upload updated ${CHECKSUMS_NAME}; restoring previous asset" >&2
|
|
|
- restore_dir="$(mktemp -d)"
|
|
|
- cp -f "${checksums_backup}" "${restore_dir}/${CHECKSUMS_NAME}"
|
|
|
- gh release upload "${TAG}" "${restore_dir}/${CHECKSUMS_NAME}" --clobber
|
|
|
- rm -rf "${restore_dir}"
|
|
|
- exit 1
|
|
|
-fi
|
|
|
+# The new archives are already on the release, so only the updated manifest
|
|
|
+# describes them. Retry it rather than restore the old one.
|
|
|
+checksums_attempts=3
|
|
|
+for attempt in $(seq 1 "${checksums_attempts}"); do
|
|
|
+ if gh release upload "${TAG}" "${checksums_path}" --clobber; then
|
|
|
+ break
|
|
|
+ fi
|
|
|
+ if [[ "${attempt}" -eq "${checksums_attempts}" ]]; then
|
|
|
+ echo "Failed to upload updated ${CHECKSUMS_NAME} after ${checksums_attempts} attempts." >&2
|
|
|
+ echo "Release ${TAG} now has signed ${names[*]} but a stale or missing ${CHECKSUMS_NAME}; re-run this job." >&2
|
|
|
+ exit 1
|
|
|
+ fi
|
|
|
+ echo "Upload of ${CHECKSUMS_NAME} failed (attempt ${attempt}/${checksums_attempts}); retrying" >&2
|
|
|
+ sleep $((attempt * 10))
|
|
|
+done
|
|
|
|
|
|
echo "Uploaded signed ${names[*]} to release ${TAG}"
|