Skip to content

Commit 6c2f2a1

Browse files
authored
Update download_cli.sh to support arbitrary Goose versions (aaif-goose#3060)
1 parent 041ebd5 commit 6c2f2a1

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

download_cli.sh

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ set -eu
1515
#
1616
# Environment variables:
1717
# GOOSE_BIN_DIR - Directory to which Goose will be installed (default: $HOME/.local/bin)
18+
# GOOSE_VERSION - Optional: specific version to install (e.g., "v1.0.25"). Overrides CANARY. Can be in the format vX.Y.Z, vX.Y.Z-suffix, or X.Y.Z
1819
# GOOSE_PROVIDER - Optional: provider for goose
1920
# GOOSE_MODEL - Optional: model for goose
2021
# CANARY - Optional: if set to "true", downloads from canary release instead of stable
@@ -41,8 +42,20 @@ REPO="block/goose"
4142
OUT_FILE="goose"
4243
GOOSE_BIN_DIR="${GOOSE_BIN_DIR:-"$HOME/.local/bin"}"
4344
RELEASE="${CANARY:-false}"
44-
RELEASE_TAG="$([[ "$RELEASE" == "true" ]] && echo "canary" || echo "stable")"
4545
CONFIGURE="${CONFIGURE:-true}"
46+
if [ -n "${GOOSE_VERSION:-}" ]; then
47+
# Validate the version format
48+
if [[ ! "$GOOSE_VERSION" =~ ^v?[0-9]+\.[0-9]+\.[0-9]+(-.*)?$ ]]; then
49+
echo "[error]: invalid version '$GOOSE_VERSION'."
50+
echo " expected: semver format vX.Y.Z, vX.Y.Z-suffix, or X.Y.Z"
51+
exit 1
52+
fi
53+
GOOSE_VERSION=$(echo "$GOOSE_VERSION" | sed 's/^v\{0,1\}/v/') # Ensure the version string is prefixed with 'v' if not already present
54+
RELEASE_TAG="$GOOSE_VERSION"
55+
else
56+
# If GOOSE_VERSION is not set, fall back to existing behavior for backwards compatibility
57+
RELEASE_TAG="$([[ "$RELEASE" == "true" ]] && echo "canary" || echo "stable")"
58+
fi
4659

4760
# --- 3) Detect OS/Architecture ---
4861
OS=$(uname -s | tr '[:upper:]' '[:lower:]')

0 commit comments

Comments
 (0)