Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
23550176a6 | ||
|
|
189304938e |
No files matched your search
+3
-1
@@ -51,7 +51,9 @@ mkdir -p "$LIB"
|
|||||||
install -m 0755 "$HERE/$NAME" "$LIB/$NAME.new"
|
install -m 0755 "$HERE/$NAME" "$LIB/$NAME.new"
|
||||||
mv -f "$LIB/$NAME.new" "$LIB/$NAME" # atomic, so upgrading a running service is safe
|
mv -f "$LIB/$NAME.new" "$LIB/$NAME" # atomic, so upgrading a running service is safe
|
||||||
rm -f "$BIN"
|
rm -f "$BIN"
|
||||||
ln -s "/usr/local/lib/$NAME/$NAME" "$BIN"
|
LINK=/usr/local/lib/$NAME/$NAME
|
||||||
|
[ -z "${DESTDIR:-}" ] || LINK=$LIB/$NAME # staging: point inside the staging folder
|
||||||
|
ln -s "$LINK" "$BIN"
|
||||||
if [ -f "$HERE/traefik" ]; then
|
if [ -f "$HERE/traefik" ]; then
|
||||||
install -m 0755 "$HERE/traefik" "$ROOT/usr/local/lib/$NAME/traefik.new"
|
install -m 0755 "$HERE/traefik" "$ROOT/usr/local/lib/$NAME/traefik.new"
|
||||||
mv -f "$ROOT/usr/local/lib/$NAME/traefik.new" "$ROOT/usr/local/lib/$NAME/traefik"
|
mv -f "$ROOT/usr/local/lib/$NAME/traefik.new" "$ROOT/usr/local/lib/$NAME/traefik"
|
||||||
|
|||||||
@@ -42,19 +42,30 @@ else
|
|||||||
echo "release $TAG already exists (id $id): replacing its files"
|
echo "release $TAG already exists (id $id): replacing its files"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
existing=$(curl -fsS -H "$AUTH" "$API/releases/$id/assets" | json 'import sys, json
|
# the ids of the release's assets with a given name (a failed upload can leave a partial one behind)
|
||||||
|
asset_ids() {
|
||||||
|
curl -fsS -H "$AUTH" "$API/releases/$id/assets" | "$PY" -c 'import sys, json
|
||||||
for a in json.load(sys.stdin):
|
for a in json.load(sys.stdin):
|
||||||
print(a["id"], a["name"])')
|
if a["name"] == sys.argv[1]:
|
||||||
|
print(a["id"])' "$1"
|
||||||
|
}
|
||||||
|
|
||||||
for f in dist/*.tar.gz dist/*.zip dist/SHA256SUMS; do
|
for f in dist/*.tar.gz dist/*.zip dist/SHA256SUMS; do
|
||||||
[ -f "$f" ] || continue
|
[ -f "$f" ] || continue
|
||||||
name=$(basename "$f")
|
name=$(basename "$f")
|
||||||
echo "$existing" | while read -r aid aname; do
|
n=1
|
||||||
if [ "$aname" = "$name" ]; then
|
while :; do
|
||||||
|
for aid in $(asset_ids "$name"); do
|
||||||
curl -fsS -X DELETE -H "$AUTH" "$API/releases/$id/assets/$aid" > /dev/null
|
curl -fsS -X DELETE -H "$AUTH" "$API/releases/$id/assets/$aid" > /dev/null
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
echo "uploading $name"
|
echo "uploading $name (attempt $n)"
|
||||||
curl -fsS -X POST -H "$AUTH" -F "attachment=@$f" "$API/releases/$id/assets?name=$name" > /dev/null
|
if curl -fsS --max-time 1200 -X POST -H "$AUTH" -F "attachment=@$f" "$API/releases/$id/assets?name=$name" > /dev/null; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
# large uploads can hit a proxy timeout (HTTP 502); try again
|
||||||
|
[ "$n" -lt 5 ] || { echo "giving up on $name after $n attempts" >&2; exit 1; }
|
||||||
|
n=$((n + 1))
|
||||||
|
sleep $((n * 10))
|
||||||
|
done
|
||||||
done
|
done
|
||||||
echo "published $SERVER/$REPO/releases/tag/$TAG"
|
echo "published $SERVER/$REPO/releases/tag/$TAG"
|
||||||
Reference in new issue
Block a user