feat(install): support pre-release version resolution
Resolve release tags via GitHub API so the installer can target latest stable, latest pre-release, or an explicit DUMBER_VERSION. Download URLs and checksums now use the resolved tag for consistent installs.
- commit
- 921cc59655b251371eda043c9123d99b63ab829f
- author
- brice · · 2026-02-09 12:47 UTC
- parent
- 4959fb8
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
1 file · +36 -2
M install.sh +36 -2
| @@ -3,8 +3,10 @@ set -e | |||
| 3 | 3 | ||
| 4 | 4 | # Dumber installer script | |
| 5 | 5 | # Usage: curl -fsSL https://dumber.bnema.dev/install | sh | |
| 6 | + | # Usage with pre-release: curl -fsSL https://dumber.bnema.dev/install | DUMBER_PRERELEASE=1 sh | |
| 6 | 7 | ||
| 7 | 8 | REPO="bnema/dumber" | |
| 9 | + | VERSION="${DUMBER_VERSION:-latest}" | |
| 8 | 10 | ||
| 9 | 11 | # Prefer ~/.local/bin if it exists and is in PATH, otherwise /usr/local/bin | |
| 10 | 12 | if [ -d "$HOME/.local/bin" ]; then | |
| @@ -36,14 +38,46 @@ fi | |||
| 36 | 38 | echo "Detected: linux/x86_64" | |
| 37 | 39 | ||
| 38 | 40 | TARBALL="dumber_linux_x86_64.tar.gz" | |
| 39 | - | DOWNLOAD_URL="https://github.com/${REPO}/releases/latest/download/${TARBALL}" | |
| 41 | + | ||
| 42 | + | # Determine version to download | |
| 43 | + | if [ "$VERSION" = "latest" ] && [ -n "$DUMBER_PRERELEASE" ]; then | |
| 44 | + | echo "Finding latest pre-release..." | |
| 45 | + | RELEASE_DATA=$(curl -fsSL "https://api.github.com/repos/${REPO}/releases?per_page=1" 2>/dev/null || echo "") | |
| 46 | + | if [ -z "$RELEASE_DATA" ]; then | |
| 47 | + | echo "Error: Failed to fetch release information from GitHub API" | |
| 48 | + | exit 1 | |
| 49 | + | fi | |
| 50 | + | VERSION=$(echo "$RELEASE_DATA" | grep -m1 '"tag_name"' | sed -E 's/.*"tag_name":\s*"([^"]+)".*/\1/') | |
| 51 | + | if [ -z "$VERSION" ]; then | |
| 52 | + | echo "Error: Could not determine latest pre-release version" | |
| 53 | + | exit 1 | |
| 54 | + | fi | |
| 55 | + | echo "Using pre-release version: ${VERSION}" | |
| 56 | + | elif [ "$VERSION" = "latest" ]; then | |
| 57 | + | echo "Using latest stable release" | |
| 58 | + | RELEASE_DATA=$(curl -fsSL "https://api.github.com/repos/${REPO}/releases/latest" 2>/dev/null || echo "") | |
| 59 | + | if [ -z "$RELEASE_DATA" ]; then | |
| 60 | + | echo "Error: Failed to fetch latest release information from GitHub API" | |
| 61 | + | exit 1 | |
| 62 | + | fi | |
| 63 | + | VERSION=$(echo "$RELEASE_DATA" | grep -m1 '"tag_name"' | sed -E 's/.*"tag_name":\s*"([^"]+)".*/\1/') | |
| 64 | + | if [ -z "$VERSION" ]; then | |
| 65 | + | echo "Error: Could not determine latest stable version" | |
| 66 | + | exit 1 | |
| 67 | + | fi | |
| 68 | + | echo "Resolved version: ${VERSION}" | |
| 69 | + | else | |
| 70 | + | echo "Using version: ${VERSION}" | |
| 71 | + | fi | |
| 72 | + | ||
| 73 | + | DOWNLOAD_URL="https://github.com/${REPO}/releases/download/${VERSION}/${TARBALL}" | |
| 40 | 74 | ||
| 41 | 75 | # Create temporary directory | |
| 42 | 76 | TMP_DIR=$(mktemp -d) | |
| 43 | 77 | trap 'rm -rf "$TMP_DIR"' EXIT | |
| 44 | 78 | ||
| 45 | 79 | # Download checksums file | |
| 46 | - | CHECKSUMS_URL="https://github.com/${REPO}/releases/latest/download/checksums.txt" | |
| 80 | + | CHECKSUMS_URL="https://github.com/${REPO}/releases/download/${VERSION}/checksums.txt" | |
| 47 | 81 | echo "Downloading checksums..." | |
| 48 | 82 | if ! curl -fsSL "$CHECKSUMS_URL" -o "$TMP_DIR/checksums.txt"; then | |
| 49 | 83 | echo "Error: Failed to download checksums file" | |
| @@ -3,8 +3,10 @@ set -e | |||||
| 3 | 3 | ||||
| 4 | # Dumber installer script | 4 | # Dumber installer script | ||
| 5 | # Usage: curl -fsSL https://dumber.bnema.dev/install | sh | 5 | # Usage: curl -fsSL https://dumber.bnema.dev/install | sh | ||
| 6 | + | # Usage with pre-release: curl -fsSL https://dumber.bnema.dev/install | DUMBER_PRERELEASE=1 sh | |||
| 6 | 7 | ||||
| 7 | REPO="bnema/dumber" | 8 | REPO="bnema/dumber" | ||
| 9 | + | VERSION="${DUMBER_VERSION:-latest}" | |||
| 8 | 10 | ||||
| 9 | # Prefer ~/.local/bin if it exists and is in PATH, otherwise /usr/local/bin | 11 | # Prefer ~/.local/bin if it exists and is in PATH, otherwise /usr/local/bin | ||
| 10 | if [ -d "$HOME/.local/bin" ]; then | 12 | if [ -d "$HOME/.local/bin" ]; then | ||
| @@ -36,14 +38,46 @@ fi | |||||
| 36 | echo "Detected: linux/x86_64" | 38 | echo "Detected: linux/x86_64" | ||
| 37 | 39 | ||||
| 38 | TARBALL="dumber_linux_x86_64.tar.gz" | 40 | TARBALL="dumber_linux_x86_64.tar.gz" | ||
| 39 | - | DOWNLOAD_URL="https://github.com/${REPO}/releases/latest/download/${TARBALL}" | 41 | + | |
| 42 | + | # Determine version to download | |||
| 43 | + | if [ "$VERSION" = "latest" ] && [ -n "$DUMBER_PRERELEASE" ]; then | |||
| 44 | + | echo "Finding latest pre-release..." | |||
| 45 | + | RELEASE_DATA=$(curl -fsSL "https://api.github.com/repos/${REPO}/releases?per_page=1" 2>/dev/null || echo "") | |||
| 46 | + | if [ -z "$RELEASE_DATA" ]; then | |||
| 47 | + | echo "Error: Failed to fetch release information from GitHub API" | |||
| 48 | + | exit 1 | |||
| 49 | + | fi | |||
| 50 | + | VERSION=$(echo "$RELEASE_DATA" | grep -m1 '"tag_name"' | sed -E 's/.*"tag_name":\s*"([^"]+)".*/\1/') | |||
| 51 | + | if [ -z "$VERSION" ]; then | |||
| 52 | + | echo "Error: Could not determine latest pre-release version" | |||
| 53 | + | exit 1 | |||
| 54 | + | fi | |||
| 55 | + | echo "Using pre-release version: ${VERSION}" | |||
| 56 | + | elif [ "$VERSION" = "latest" ]; then | |||
| 57 | + | echo "Using latest stable release" | |||
| 58 | + | RELEASE_DATA=$(curl -fsSL "https://api.github.com/repos/${REPO}/releases/latest" 2>/dev/null || echo "") | |||
| 59 | + | if [ -z "$RELEASE_DATA" ]; then | |||
| 60 | + | echo "Error: Failed to fetch latest release information from GitHub API" | |||
| 61 | + | exit 1 | |||
| 62 | + | fi | |||
| 63 | + | VERSION=$(echo "$RELEASE_DATA" | grep -m1 '"tag_name"' | sed -E 's/.*"tag_name":\s*"([^"]+)".*/\1/') | |||
| 64 | + | if [ -z "$VERSION" ]; then | |||
| 65 | + | echo "Error: Could not determine latest stable version" | |||
| 66 | + | exit 1 | |||
| 67 | + | fi | |||
| 68 | + | echo "Resolved version: ${VERSION}" | |||
| 69 | + | else | |||
| 70 | + | echo "Using version: ${VERSION}" | |||
| 71 | + | fi | |||
| 72 | + | ||||
| 73 | + | DOWNLOAD_URL="https://github.com/${REPO}/releases/download/${VERSION}/${TARBALL}" | |||
| 40 | 74 | ||||
| 41 | # Create temporary directory | 75 | # Create temporary directory | ||
| 42 | TMP_DIR=$(mktemp -d) | 76 | TMP_DIR=$(mktemp -d) | ||
| 43 | trap 'rm -rf "$TMP_DIR"' EXIT | 77 | trap 'rm -rf "$TMP_DIR"' EXIT | ||
| 44 | 78 | ||||
| 45 | # Download checksums file | 79 | # Download checksums file | ||
| 46 | - | CHECKSUMS_URL="https://github.com/${REPO}/releases/latest/download/checksums.txt" | 80 | + | CHECKSUMS_URL="https://github.com/${REPO}/releases/download/${VERSION}/checksums.txt" |
| 47 | echo "Downloading checksums..." | 81 | echo "Downloading checksums..." | ||
| 48 | if ! curl -fsSL "$CHECKSUMS_URL" -o "$TMP_DIR/checksums.txt"; then | 82 | if ! curl -fsSL "$CHECKSUMS_URL" -o "$TMP_DIR/checksums.txt"; then | ||
| 49 | echo "Error: Failed to download checksums file" | 83 | echo "Error: Failed to download checksums file" | ||