fix: dynamically resolve release download URL via API #3

Merged
rootiest merged 1 commits from fix-installer-url into main 2026-08-06 04:05:13 +00:00
+9 -2
View File
@@ -2,7 +2,7 @@
set -e
REPO_URL="https://git.rootiest.dev/rootiest/icon-color-tool.git"
DOWNLOAD_URL="https://git.rootiest.dev/rootiest/icon-color-tool/releases/latest/download/icon-color-tool"
API_URL="https://git.rootiest.dev/api/v1/repos/rootiest/icon-color-tool/releases/latest"
INSTALL_DIR="${XDG_BIN_HOME:-$HOME/.local/bin}"
TMP_DIR=$(mktemp -d)
@@ -35,9 +35,16 @@ if [ "$BUILD" -eq 1 ]; then
cd - > /dev/null
else
echo "Mode: Downloading pre-built binary"
DOWNLOAD_URL=$(curl -sL "$API_URL" | grep -o '"browser_download_url":"[^"]*"' | cut -d'"' -f4 | head -n 1)
if [ -z "$DOWNLOAD_URL" ]; then
echo "Error: Could not find latest release binary download URL."
echo "If the release doesn't exist yet, you can use the --build flag to build from source."
exit 1
fi
if ! curl -sfL "$DOWNLOAD_URL" -o "$TMP_DIR/icon-color-tool"; then
echo "Error: Failed to download binary from $DOWNLOAD_URL"
echo "If the release doesn't exist yet, you can use the --build flag to build from source."
exit 1
fi
fi