fix(install): resolve latest tag from GitHub API before downloading
The stable release path left VERSION="latest" as a literal string, causing 404 errors since GitHub download URLs require exact tag names.
- commit
- b7669ff1660ba2a0cf5c596e0c1028de7600175a
- author
- brice · · 2026-02-01 07:34 UTC
- parent
- 8ebdfe0
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
1 file · +12 -1
M install.sh +12 -1
| @@ -62,8 +62,19 @@ if [ "$VERSION" = "latest" ] && [ -n "$GORDON_PRERELEASE" ]; then | |||
| 62 | 62 | fi | |
| 63 | 63 | echo "Using pre-release version: ${VERSION}" | |
| 64 | 64 | elif [ "$VERSION" = "latest" ]; then | |
| 65 | - | VERSION="latest" | |
| 66 | 65 | echo "Using latest stable release" | |
| 66 | + | # Resolve "latest" to actual tag name since GitHub download URLs require exact tags | |
| 67 | + | RELEASE_DATA=$(curl -fsSL "https://api.github.com/repos/${REPO}/releases/latest" 2>/dev/null || echo "") | |
| 68 | + | if [ -z "$RELEASE_DATA" ]; then | |
| 69 | + | echo "Error: Failed to fetch latest release information from GitHub API" | |
| 70 | + | exit 1 | |
| 71 | + | fi | |
| 72 | + | VERSION=$(echo "$RELEASE_DATA" | grep -m1 '"tag_name"' | sed -E 's/.*"tag_name":\s*"([^"]+)".*/\1/') | |
| 73 | + | if [ -z "$VERSION" ]; then | |
| 74 | + | echo "Error: Could not determine latest stable version" | |
| 75 | + | exit 1 | |
| 76 | + | fi | |
| 77 | + | echo "Resolved version: ${VERSION}" | |
| 67 | 78 | else | |
| 68 | 79 | echo "Using version: ${VERSION}" | |
| 69 | 80 | fi | |
| @@ -62,8 +62,19 @@ if [ "$VERSION" = "latest" ] && [ -n "$GORDON_PRERELEASE" ]; then | |||||
| 62 | fi | 62 | fi | ||
| 63 | echo "Using pre-release version: ${VERSION}" | 63 | echo "Using pre-release version: ${VERSION}" | ||
| 64 | elif [ "$VERSION" = "latest" ]; then | 64 | elif [ "$VERSION" = "latest" ]; then | ||
| 65 | - | VERSION="latest" | |||
| 66 | echo "Using latest stable release" | 65 | echo "Using latest stable release" | ||
| 66 | + | # Resolve "latest" to actual tag name since GitHub download URLs require exact tags | |||
| 67 | + | RELEASE_DATA=$(curl -fsSL "https://api.github.com/repos/${REPO}/releases/latest" 2>/dev/null || echo "") | |||
| 68 | + | if [ -z "$RELEASE_DATA" ]; then | |||
| 69 | + | echo "Error: Failed to fetch latest release information from GitHub API" | |||
| 70 | + | exit 1 | |||
| 71 | + | fi | |||
| 72 | + | VERSION=$(echo "$RELEASE_DATA" | grep -m1 '"tag_name"' | sed -E 's/.*"tag_name":\s*"([^"]+)".*/\1/') | |||
| 73 | + | if [ -z "$VERSION" ]; then | |||
| 74 | + | echo "Error: Could not determine latest stable version" | |||
| 75 | + | exit 1 | |||
| 76 | + | fi | |||
| 77 | + | echo "Resolved version: ${VERSION}" | |||
| 67 | else | 78 | else | ||
| 68 | echo "Using version: ${VERSION}" | 79 | echo "Using version: ${VERSION}" | ||
| 69 | fi | 80 | fi | ||