|
@@ -46,10 +46,10 @@ checksums_path="${DIST_DIR}/${CHECKSUMS_NAME}"
|
|
|
|
|
|
|
|
# gh release upload --clobber deletes the old asset before uploading, so an
|
|
# gh release upload --clobber deletes the old asset before uploading, so an
|
|
|
# earlier run that failed to upload the manifest can leave the release without
|
|
# earlier run that failed to upload the manifest can leave the release without
|
|
|
-# one. The manifest lists every other release asset, so it can be rebuilt from
|
|
|
|
|
|
|
+# one, or with an incomplete one. The manifest lists every other release asset, so it can be rebuilt from
|
|
|
# the sha256 digests GitHub records for them.
|
|
# the sha256 digests GitHub records for them.
|
|
|
rebuild_checksums() {
|
|
rebuild_checksums() {
|
|
|
- echo "${CHECKSUMS_NAME} is missing from release ${TAG}; rebuilding it from release asset digests" >&2
|
|
|
|
|
|
|
+ echo "${CHECKSUMS_NAME} is missing or incomplete on release ${TAG}; rebuilding it from release asset digests" >&2
|
|
|
local assets
|
|
local assets
|
|
|
assets="$(gh release view "${TAG}" --json assets \
|
|
assets="$(gh release view "${TAG}" --json assets \
|
|
|
--jq ".assets[] | select(.name != \"${CHECKSUMS_NAME}\") | \"\(.digest // \"none\") \(.name)\"")"
|
|
--jq ".assets[] | select(.name != \"${CHECKSUMS_NAME}\") | \"\(.digest // \"none\") \(.name)\"")"
|
|
@@ -66,8 +66,10 @@ rebuild_checksums() {
|
|
|
done <<< "${assets}"
|
|
done <<< "${assets}"
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-release_assets="$(gh release view "${TAG}" --json assets --jq '.assets[].name')"
|
|
|
|
|
-if grep -qxF "${CHECKSUMS_NAME}" <<< "${release_assets}"; then
|
|
|
|
|
|
|
+# A failed upload can leave an empty asset in the "starter" state; only an
|
|
|
|
|
+# "uploaded" manifest is complete enough to update.
|
|
|
|
|
+uploaded_assets="$(gh release view "${TAG}" --json assets --jq '.assets[] | select(.state == "uploaded") | .name')"
|
|
|
|
|
+if grep -qxF "${CHECKSUMS_NAME}" <<< "${uploaded_assets}"; then
|
|
|
if ! gh release download "${TAG}" --pattern "${CHECKSUMS_NAME}" --dir "${DIST_DIR}" --clobber; then
|
|
if ! gh release download "${TAG}" --pattern "${CHECKSUMS_NAME}" --dir "${DIST_DIR}" --clobber; then
|
|
|
echo "Failed to download ${CHECKSUMS_NAME} from release ${TAG}" >&2
|
|
echo "Failed to download ${CHECKSUMS_NAME} from release ${TAG}" >&2
|
|
|
exit 1
|
|
exit 1
|