Releases

_git_fetch_release_json

Resolve a GitHub release version tag to a JSON blob via the API. Tries the tag as-is, then with a 'v' prefix, then with 'release-' prefix. Writes JSON to stdout. Completely silent on failure.

Arguments

  • $1 (string): owner/repo slug
  • $2 (string): Version tag, or 'latest'

Exit codes

  • 0: Release found
  • 1: No matching release found

Output on stdout

  • Release JSON from the GitHub API

_git_fetch_release_arch_aliases

Return the arch aliases to try when matching release asset filenames.

Arguments

  • $1 (string): Normalised OS_ARCH value (x86_64, aarch64, arm, ...)

Output on stdout

  • Space-separated alias list, highest-priority first

git_fetch_release

Fetch a release asset from a GitHub repository. Downloads the asset to the current directory. Does not extract archives. Requires curl and jq.

Example

git_fetch_release cli/cli
git_fetch_release cli/cli v2.40.0
git_fetch_release cli/cli latest arm64

Arguments

  • $1 (string): owner/repo slug (required)
  • $2 (string): Version tag, or 'latest' (default: latest)
  • $3 (string): Architecture override (default: detected from uname -m)

Exit codes

  • 0: Asset downloaded successfully
  • 1: Error (missing args, no matching asset, download failure)

Output on stdout

  • Download progress from curl