Skip to main content

Github Release Install

@svendowideit/github-release-installv2026.11.21.1· MIT(was none)· 2d agoBEHAVIORSWORKFLOWSACCEPTED WARNINGS
01README

Resolve any GitHub repository's latest (or pinned) release, pick the right archive for this machine, verify it against the release's checksums, and download a verified file — the reusable core of a binary auto-updater. WHAT IT DOES

Turns "install the latest release of X" into two repeatable commands for any repository that publishes release assets. It reads the GitHub releases API, probes the local OS and architecture (uname), matches them against each asset's parsed name (tool_1.2.3_Linux_x86_64.tar.gz), records the archive's checksum from the release's checksums file, and downloads the archive only after the bytes match that hash. It also preserves the raw GitHub payload and can render it into a Markdown release document.

Platform matching is by family, so a host probe of Linux/x86_64 resolves a publisher that names assets linux/amd64 (caddyserver/caddy). Checksums in any of SHA-1/256/384/512 are verified, chosen from the digest length, and a version-prefixed checksums file (caddy_2.11.4_checksums.txt) is found without extra configuration. When a release ships several archives for one platform (tuios publishes main, ghostty and web), all matches are recorded in preference order and the base build is chosen — pass stem or assetName to pick another.

Prefer it over a curl of a release URL: the download is verified before it is written, the platform match is explicit, and one model serves every repository. The same checksum-verified download pattern @swamp/deno-runner uses for Deno is generalised here to any repo, any release, and tar.gz / zip / raw archives.

A verified archive is cached cheaply: after a successful verification the download writes a sidecar <archive>.verified.json marker, and a later run with the same expected checksum and an unchanged file reuses it without re-reading and re-hashing the whole archive (previously a large archive was re-hashed on every run). A missing or stale marker falls back to a full re-hash, so the verification guarantee is unchanged.

INSTALL

swamp extension pull @svendowideit/github-release-install

DEPENDENCIES

None — it uses Deno's built-in fetch and the bundled Deno binary swamp already ships. No other extension is required, and nothing is installed on the host. A GitHub token is optional. GitHub's releases API allows only 60 anonymous requests per hour; the extension resolves a token from, in order, the githubToken global, GITHUB_TOKEN, GH_TOKEN, then the authenticated gh CLI (gh auth token). So gh auth login is enough to lift the limit. Check what a run would use with the authStatus method:

  swamp model @svendowideit/github-release-install method run authStatus gh \
    --input repo=Gaurav-Gosain/tuios

RUN

# One-shot, no model instance to create first: a direct type run with
# --input. Any key (method argument or global) can be passed this way,
# and the definition is auto-created on first use.
swamp model @svendowideit/github-release-install method run check caddy \
  --input repo=caddyserver/caddy

# Or create a named instance once and reuse it (globals via --global-arg).
swamp model create @svendowideit/github-release-install rel \
  --global-arg repo=Gaurav-Gosain/tuios --global-arg stem=tuios
swamp model @svendowideit/github-release-install method run check rel

# Resolve and download a verified archive to a path in one workflow run.
swamp workflow run @svendowideit/github-release-install-fetch \
  --input repo=Gaurav-Gosain/tuios \
  --input outputPath=~/.cache/tuios/tuios.tar.gz

# Pin a version and ask what a different platform would download,
# without touching this machine (per-call values use --input).
swamp model @svendowideit/github-release-install method run check rel \
  --input version=0.8.0 --input os=Darwin --input arch=arm64

# Render the resolved release (notes + asset table) into Markdown.
swamp model @svendowideit/github-release-install method run render rel

Release metadata for many repositories in one call — newest version and

publication date, the LTS and dev channels, recent tags, archived flag.

Cached for ttlSeconds and capped at maxRepos so a fleet sweep cannot burn

the rate limit.

swamp model create @svendowideit/github-release-install release-meta swamp model method run release-meta metadataMany
--input 'repos:json=["ollama/ollama","caddyserver/caddy"]'

CONFIGURE

Any global argument may also be passed per call with --input, so a direct type run needs no pre-created instance. Globals (set at creation with --global-arg, or per call with --input):

repo             GitHub repository (owner/name)     (required; or set apiUrl)
apiUrl           explicit releases API URL          (default: derived from repo)
stem             required asset product name        (default: any)
assetPattern     regex the asset name must match;   (default: GoReleaser
                 named groups version/os/arch        tool_<v>_<Os>_<arch>[.ext])
checksumsName    checksums asset name               (default checksums.txt)
format           auto | tar.gz | zip | raw          (default auto)
githubToken      raises the API rate limit          (default: GITHUB_TOKEN,
                                                     GH_TOKEN, then `gh auth token`)
userAgent        User-Agent header                  (default swamp-github-release/1.0)
os / arch        override the detected platform     (default: host probe)

Per-run overrides: authStatus takes checkRemaining; check takes version, os, arch, stem, assetName, pattern, fetchChecksums and requireChecksum; download takes version, outputPath/outputDir, checksum/downloadUrl/assetName (to consume a prior check), checksumsUrl, force and requireChecksum; render takes includeBody, includeAssets and maxBodyChars. Precedence is per-call --input > model global > schema default. format both records the archive format and filters selection (use it when a release offers the same platform as more than one format). A checksum is mandatory on both paths: check fails when the checksums file cannot be fetched or does not list the archive, and download refuses an archive whose bytes do not match.

WHAT IT INSTALLS

Nothing on the host — no services, daemons, cron triggers, or webhooks. It writes the verified archive to the outputPath/outputDir you pass to download (nothing is written when both are empty), and writes swamp resources (release, archive, summary, document, authStatus). Installing or extracting the downloaded archive is the caller's job — @svendowideit/tuios uses it to keep the tuios binary current.

02Behaviors1
@svendowideit/github-release-installv2026.11.21.1github_release_install.ts

Global Arguments

ArgumentTypeDescription
repo?stringGitHub repository (owner/name) publishing the releases, e.g. Gaurav-Gosain/tuios. Used to derive apiUrl when that is empty.
apiUrl?stringGitHub releases API URL for the latest release. Empty derives it from repo (https://api.github.com/repos/<repo>/releases/latest).
userAgent?stringUser-Agent header sent to the GitHub API and asset downloads.
githubToken?stringGitHub token used to raise the API rate limit. Empty falls back to GITHUB_TOKEN or GH_TOKEN.
os?stringOverride the detected release OS token (e.g. Linux, Darwin). Empty probes the host with uname.
arch?stringOverride the detected release architecture token (e.g. x86_64, arm64). Empty probes the host with uname.
stem?stringRequired product name the asset file name must start with (e.g. 'tuios' or 'tuios-ghostty'). Empty matches any stem.
assetPattern?stringRegular expression an archive asset's file name must match. Must define named groups (?<version>…), (?<os>…) and (?<arch>…); (?<stem>…) and (?<ext>…) are optional.
checksumsName?stringName of the release asset listing every archive's SHA-256.
format?enumArchive format: auto derives it from the file name; tar.gz, zip and raw force it.
fn authStatus(checkRemaining?: boolean)
Report how GitHub API requests will authenticate (explicit token,
ArgumentTypeDescription
checkRemaining?booleanMake one authenticated request to the releases API and report the
fn metadataMany(repos?: array, maxRepos?: number, perRepo?: number, ttlSeconds?: number, detectChannels?: boolean)
Fetch release metadata for many repositories in one call: newest
ArgumentTypeDescription
repos?arrayRepositories as owner/name. Duplicates are removed; the list is capped at
maxRepos?numberMaximum repositories fetched in this call.
perRepo?numberReleases read per repository (newest first).
ttlSeconds?numberReuse a repository's previous metadata when it was fetched within this
detectChannels?booleanAlso report the LTS and development (prerelease) channels.
fn check(version?: string, os?: string, arch?: string, stem?: string, assetName?: string, pattern?: string, fetchChecksums?: boolean, requireChecksum?: boolean)
Fetch a GitHub release (latest, or a pinned version), select the
ArgumentTypeDescription
version?stringRelease version to resolve (e.g. 0.8.0 or v0.8.0). Empty resolves the latest release.
os?stringOverride the release OS token for this call (e.g. Linux). Empty uses the model global / host probe.
arch?stringOverride the release architecture token for this call (e.g. arm64). Empty uses the model global / host probe.
stem?stringOverride the required asset stem for this call.
assetName?stringForce an exact archive file name instead of selecting by platform.
pattern?stringOverride the model's assetPattern for this call.
fetchChecksums?booleanDownload the checksums file and record the selected archive's SHA-256. Set false to skip the extra request.
requireChecksum?booleanFail when the selected archive's SHA-256 cannot be resolved. Set false to record the release unverified.
fn download(version?: string, outputPath?: string, outputDir?: string, assetName?: string, downloadUrl?: string, releaseVersion?: string, checksum?: string, checksumsUrl?: string, os?: string, arch?: string, stem?: string, pattern?: string, format?: enum, requireChecksum?: boolean, force?: boolean)
Download the release archive for this platform, verify it against the
ArgumentTypeDescription
version?stringRelease version to download (e.g. 0.8.0). Empty downloads the latest release.
outputPath?stringExact absolute or ~-prefixed file path to write the verified archive to. Wins over outputDir. Empty (with outputDir empty too) downloads into memory only.
outputDir?stringDirectory to write the verified archive into, keeping the release's archive file name. Used when outputPath is empty.
assetName?stringForce an exact archive file name to download, overriding platform selection. The bundled workflow supplies this from the release resource.
downloadUrl?stringArchive URL resolved by `check`. When set with checksum and releaseVersion it avoids re-fetching the release.
releaseVersion?stringThe version `check` resolved, used to confirm downloadUrl matches the requested version.
checksum?stringExpected SHA-256 of the archive, resolved by `check`. When set with the URL and archive name it avoids re-fetching the release. Download fails when the bytes do not match.
checksumsUrl?stringOverride the checksums file URL. Empty derives it from the release's assets.
os?stringOverride the release OS token for this call.
arch?stringOverride the release architecture token for this call.
stem?stringOverride the required asset stem for this call.
pattern?stringOverride the model's assetPattern for this call.
format?enumOverride the archive format for this call.
requireChecksum?booleanRefuse to download when no SHA-256 can be resolved for the selected archive.
force?booleanRe-download even when outputPath already holds a file with the expected SHA-256.
fn render(includeBody?: boolean, includeAssets?: boolean, maxBodyChars?: number)
Render the stored release — including the preserved raw GitHub payload
ArgumentTypeDescription
includeBody?booleanInclude the release notes body in the rendered Markdown.
includeAssets?booleanInclude the asset table in the rendered Markdown.
maxBodyChars?numberTruncate the release notes to this many characters. 0 keeps the full body.
fn print(installedVersion: preprocess)
Log the stored release and archive: the version, the platform archive,
ArgumentTypeDescription
installedVersionpreprocess

Resources

release(infinite)— The resolved release plus the archive selected for this platform
archive(infinite)— The verified archive download result
summary(infinite)— The printed release/archive summary
document(infinite)— The rendered Markdown release document (notes and asset table)
releases(infinite)— Release metadata for many repositories at once: newest version and
authStatus(infinite)— The resolved GitHub authentication status and rate-limit guidance
03Workflows1
@svendowideit/github-release-install-fetch357211e6-d5c8-4d7e-9c7b-28542505c990

Resolve a GitHub repository's latest (or pinned) release, select the archive for this machine, verify it against the release's checksums, and download it to a path — the reusable "fetch a GitHub release" seam. Steps: resolve (check) → download → render → print. resolve reads the release from the GitHub releases API, selects the archive matching the local OS/architecture (or an explicit override), and records its expected SHA-256 from the release's checksums file. download fetches the archive,

mainResolve the release, download and verify the archive, then print the result.
1.resolve— Fetch the release and record the platform archive and its expected SHA-256, from the GitHub releases API and the release's checksums file.
2.download— Download the archive resolved by `resolve`, verify its SHA-256 against the checksums file, and write the verified file to `outputPath`. Refuses an archive whose hash does not match.
3.render— Render the resolved release — the preserved GitHub payload's notes and the asset table — into a Markdown document resource, so a caller (or a human) can read the release without another API call. Skipped when `render=false`.
4.print— Print the release, the platform archive, its SHA-256 and the verified file path, so the run log ends with what was resolved and downloaded.
04Previous Versions3
2026.10.11.1
2026.09.30.2
2026.09.30.1
05Stats
A
100 / 100
Downloads
80
Archive size
64.2 KB
  • Has README or module doc2/2earned
  • README has a code example1/1earned
  • README is substantive1/1earned
  • Most symbols documented1/1earned
  • No slow types (deprecated)1/1earned
  • Dependencies pass trust audit2/2earned
  • Docs keep secrets in a vault1/1earned
  • Has description1/1earned
  • Platform support declared (or universal)2/2earned
  • License2/2earned
  • Verified public repository2/2earned

07Platforms