Fix copied over (#7270)
Co-authored-by: Douwe Osinga <douwe@squareup.com> - this was approved just need to get it in
This commit is contained in:
+21
-2
@@ -197,8 +197,27 @@ DOWNLOAD_URL="https://github.com/$REPO/releases/download/$RELEASE_TAG/$FILE"
|
|||||||
# --- 4) Download & extract 'goose' binary ---
|
# --- 4) Download & extract 'goose' binary ---
|
||||||
echo "Downloading $RELEASE_TAG release: $FILE..."
|
echo "Downloading $RELEASE_TAG release: $FILE..."
|
||||||
if ! curl -sLf "$DOWNLOAD_URL" --output "$FILE"; then
|
if ! curl -sLf "$DOWNLOAD_URL" --output "$FILE"; then
|
||||||
echo "Error: Failed to download $DOWNLOAD_URL"
|
# If the download fails, only fall back to latest stable when no version was specified and canary was not requested).
|
||||||
exit 1
|
if ! [ -n "${GOOSE_VERSION:-}" ] && [ "${CANARY:-false}" != "true" ]; then
|
||||||
|
LATEST_TAG=$(curl -s https://api.github.com/repos/block/goose/releases/latest | \
|
||||||
|
grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
|
||||||
|
if [ -z "$LATEST_TAG" ]; then
|
||||||
|
echo "Error: Failed to download $DOWNLOAD_URL and latest tag unavailable"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
DOWNLOAD_URL="https://github.com/$REPO/releases/download/$LATEST_TAG/$FILE"
|
||||||
|
if curl -sLf "$DOWNLOAD_URL" --output "$FILE"; then
|
||||||
|
# Fallback succeeded
|
||||||
|
:
|
||||||
|
else
|
||||||
|
echo "Error: Failed to download from fallback url $DOWNLOAD_URL using latest tag $LATEST_TAG"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Error: Failed to download $DOWNLOAD_URL"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Create a temporary directory for extraction
|
# Create a temporary directory for extraction
|
||||||
|
|||||||
Reference in New Issue
Block a user