Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions bin/install-latest-linux.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
#!/usr/bin/env bash
set -eo pipefail

# Install the latest version of the Linux binary
DOWNLOAD_URL="$(curl -s https://api.github.com/repos/brevdev/brev-cli/releases/latest | grep "browser_download_url.*linux.*amd64" | cut -d '"' -f 4)"
# Fetch release metadata from GitHub API
API_RESPONSE="$(curl -sf https://api.github.com/repos/brevdev/brev-cli/releases/latest 2>&1)" || {
echo "Error: Failed to fetch release info from GitHub API." >&2
echo "This may be caused by rate limiting. Try again later or set a GITHUB_TOKEN." >&2
exit 1
}

# Extract the download URL for linux/amd64
DOWNLOAD_URL="$(echo "${API_RESPONSE}" | grep "browser_download_url.*linux.*amd64" | cut -d '"' -f 4)"
if [ -z "${DOWNLOAD_URL}" ]; then
echo "Error: Could not find release for linux amd64" >&2
exit 1
fi

# Create temporary directory and ensure cleanup
TMP_DIR="$(mktemp -d)"
Expand Down
11 changes: 8 additions & 3 deletions bin/install-latest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,15 @@ case "${ARCH}" in
aarch64) ARCH="arm64" ;;
esac

# Get the appropriate download URL for this platform
DOWNLOAD_URL="$(curl -s https://api.github.com/repos/brevdev/brev-cli/releases/latest | grep "browser_download_url.*${OS}.*${ARCH}" | cut -d '"' -f 4)"
# Fetch release metadata from GitHub API
API_RESPONSE="$(curl -sf https://api.github.com/repos/brevdev/brev-cli/releases/latest 2>&1)" || {
echo "Error: Failed to fetch release info from GitHub API." >&2
echo "This may be caused by rate limiting. Try again later or set a GITHUB_TOKEN." >&2
exit 1
}

# Verify we found a suitable release
# Extract the download URL for this platform
DOWNLOAD_URL="$(echo "${API_RESPONSE}" | grep "browser_download_url.*${OS}.*${ARCH}" | cut -d '"' -f 4)"
if [ -z "${DOWNLOAD_URL}" ]; then
echo "Error: Could not find release for ${OS} ${ARCH}" >&2
exit 1
Expand Down