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
16 changes: 13 additions & 3 deletions install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,20 @@ function Get-Arch {
}

function Get-LatestTag {
$url = "https://api.github.com/repos/$Repo/releases/latest"
# We publish two parallel release tracks under the same repo:
# v* — CLI binary releases (this script installs these).
# extension-v* — VS Code / Cursor extension .vsix releases.
# /releases/latest returns whichever was published most recently overall and
# can flip to an extension release any time we publish an extension after a
# CLI release — that yields the `extension-v*` tag and a 404 when this
# script tries to download `axme-code-$platform` from it. Fetch the list
# endpoint instead and filter to the first `v[0-9]…` tag.
$url = "https://api.github.com/repos/$Repo/releases?per_page=30"
try {
$release = Invoke-RestMethod -Uri $url -Headers @{ 'User-Agent' = 'axme-code-installer' }
return $release.tag_name
$releases = Invoke-RestMethod -Uri $url -Headers @{ 'User-Agent' = 'axme-code-installer' }
$cliRelease = $releases | Where-Object { $_.tag_name -match '^v[0-9]' } | Select-Object -First 1
if (-not $cliRelease) { throw "No CLI release (tag matching ^v[0-9]) found in the 30 most recent releases." }
return $cliRelease.tag_name
} catch {
throw "Failed to fetch latest release from $url : $($_.Exception.Message)"
}
Expand Down
14 changes: 11 additions & 3 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,19 @@ detect_platform() {

# Get latest release tag from GitHub API
get_latest_version() {
local url="https://api.github.com/repos/${REPO}/releases/latest"
# We publish two parallel release tracks under the same repo:
# - `v*` — CLI binary releases (this script installs these).
# - `extension-v*` — VS Code / Cursor extension .vsix releases.
# `/releases/latest` returns the most recently published release overall and
# can flip to an extension release any time we publish an extension after a
# CLI release. That returns the `extension-v*` tag, and the binary download
# URL `axme-code-${platform}` 404s because the extension release only ships
# `.vsix` files. Fetch the recent list and filter to the first `v[0-9]…` tag.
local url="https://api.github.com/repos/${REPO}/releases?per_page=30"
if command -v curl &>/dev/null; then
curl -fsSL "$url" | grep '"tag_name"' | head -1 | sed 's/.*"tag_name": *"//;s/".*//'
curl -fsSL "$url" | grep '"tag_name"' | sed 's/.*"tag_name": *"//;s/".*//' | grep -E '^v[0-9]' | head -1
elif command -v wget &>/dev/null; then
wget -qO- "$url" | grep '"tag_name"' | head -1 | sed 's/.*"tag_name": *"//;s/".*//'
wget -qO- "$url" | grep '"tag_name"' | sed 's/.*"tag_name": *"//;s/".*//' | grep -E '^v[0-9]' | head -1
else
echo "Neither curl nor wget found" >&2; exit 1
fi
Expand Down
Loading