File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,10 +26,20 @@ function Get-Arch {
2626}
2727
2828function Get-LatestTag {
29- $url = " https://api.github.com/repos/$Repo /releases/latest"
29+ # We publish two parallel release tracks under the same repo:
30+ # v* — CLI binary releases (this script installs these).
31+ # extension-v* — VS Code / Cursor extension .vsix releases.
32+ # /releases/latest returns whichever was published most recently overall and
33+ # can flip to an extension release any time we publish an extension after a
34+ # CLI release — that yields the `extension-v*` tag and a 404 when this
35+ # script tries to download `axme-code-$platform` from it. Fetch the list
36+ # endpoint instead and filter to the first `v[0-9]…` tag.
37+ $url = " https://api.github.com/repos/$Repo /releases?per_page=30"
3038 try {
31- $release = Invoke-RestMethod - Uri $url - Headers @ { ' User-Agent' = ' axme-code-installer' }
32- return $release.tag_name
39+ $releases = Invoke-RestMethod - Uri $url - Headers @ { ' User-Agent' = ' axme-code-installer' }
40+ $cliRelease = $releases | Where-Object { $_.tag_name -match ' ^v[0-9]' } | Select-Object - First 1
41+ if (-not $cliRelease ) { throw " No CLI release (tag matching ^v[0-9]) found in the 30 most recent releases." }
42+ return $cliRelease.tag_name
3343 } catch {
3444 throw " Failed to fetch latest release from $url : $ ( $_.Exception.Message ) "
3545 }
Original file line number Diff line number Diff line change @@ -27,11 +27,19 @@ detect_platform() {
2727
2828# Get latest release tag from GitHub API
2929get_latest_version () {
30- local url=" https://api.github.com/repos/${REPO} /releases/latest"
30+ # We publish two parallel release tracks under the same repo:
31+ # - `v*` — CLI binary releases (this script installs these).
32+ # - `extension-v*` — VS Code / Cursor extension .vsix releases.
33+ # `/releases/latest` returns the most recently published release overall and
34+ # can flip to an extension release any time we publish an extension after a
35+ # CLI release. That returns the `extension-v*` tag, and the binary download
36+ # URL `axme-code-${platform}` 404s because the extension release only ships
37+ # `.vsix` files. Fetch the recent list and filter to the first `v[0-9]…` tag.
38+ local url=" https://api.github.com/repos/${REPO} /releases?per_page=30"
3139 if command -v curl & > /dev/null; then
32- curl -fsSL " $url " | grep ' "tag_name"' | head -1 | sed ' s/.*"tag_name": *"//;s/".*//'
40+ curl -fsSL " $url " | grep ' "tag_name"' | sed ' s/.*"tag_name": *"//;s/".*//' | grep -E ' ^v[0-9] ' | head -1
3341 elif command -v wget & > /dev/null; then
34- wget -qO- " $url " | grep ' "tag_name"' | head -1 | sed ' s/.*"tag_name": *"//;s/".*//'
42+ wget -qO- " $url " | grep ' "tag_name"' | sed ' s/.*"tag_name": *"//;s/".*//' | grep -E ' ^v[0-9] ' | head -1
3543 else
3644 echo " Neither curl nor wget found" >&2 ; exit 1
3745 fi
You can’t perform that action at this time.
0 commit comments