diff --git a/install.ps1 b/install.ps1 index 57acc25..8eb5de7 100644 --- a/install.ps1 +++ b/install.ps1 @@ -23,12 +23,24 @@ $Arch = switch ($env:PROCESSOR_ARCHITECTURE) { } if ($Version -eq "latest") { - Write-Host "Resolving the latest SciMesh release..." - $Url = "https://github.com/$Repo/releases/latest/download/coordinator-windows-$Arch.exe" -} else { - $Url = "https://github.com/$Repo/releases/download/$Version/coordinator-windows-$Arch.exe" + Write-Host "Resolving the newest SciMesh release (including pre-releases)..." + # /releases/latest only sees stable releases; the API list is newest-first + # across all channels. + try { + $Releases = Invoke-RestMethod -Uri "https://api.github.com/repos/$Repo/releases?per_page=1" + if ($Releases -and $Releases[0].tag_name) { + $Version = $Releases[0].tag_name + Write-Host " -> $Version" + } else { + Write-Host " -> falling back to the stable latest release" + } + } catch { + Write-Host " -> falling back to the stable latest release" + } } +$Url = "https://github.com/$Repo/releases/download/$Version/coordinator-windows-$Arch.exe" + New-Item -ItemType Directory -Force -Path $InstallDir | Out-Null $Target = Join-Path $InstallDir "coordinator.exe" diff --git a/install.sh b/install.sh index 039a202..fee72e8 100644 --- a/install.sh +++ b/install.sh @@ -27,15 +27,23 @@ case "$(uname -m)" in esac if [ "$VERSION" = "latest" ]; then - echo "Resolving the latest SciMesh release..." - URL="https://github.com/${REPO}/releases/latest/download/coordinator-${OS}-${ARCH}" -else - URL="https://github.com/${REPO}/releases/download/${VERSION}/coordinator-${OS}-${ARCH}" + echo "Resolving the newest SciMesh release (including pre-releases)..." + # GitHub's /releases/latest only sees stable releases; the API list is + # newest-first across all channels. Without jq, pull the first tag_name. + RESOLVED=$(curl -fsSL "https://api.github.com/repos/${REPO}/releases?per_page=1" \ + | sed -n 's/.*"tag_name"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' | head -1) + if [ -n "$RESOLVED" ]; then + VERSION="$RESOLVED" + echo " -> $VERSION" + else + echo " -> falling back to the stable latest release" + fi fi mkdir -p "$INSTALL_DIR" TARGET="$INSTALL_DIR/coordinator" +URL="https://github.com/${REPO}/releases/download/${VERSION}/coordinator-${OS}-${ARCH}" echo "Downloading $URL" curl -fsSL -o "$TARGET.tmp" "$URL" chmod +x "$TARGET.tmp"