Github Release Install
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-installDEPENDENCIES
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/tuiosRUN
# 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 relRelease 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.
Global Arguments
| Argument | Type | Description |
|---|---|---|
| repo? | string | GitHub repository (owner/name) publishing the releases, e.g. Gaurav-Gosain/tuios. Used to derive apiUrl when that is empty. |
| apiUrl? | string | GitHub releases API URL for the latest release. Empty derives it from repo (https://api.github.com/repos/<repo>/releases/latest). |
| userAgent? | string | User-Agent header sent to the GitHub API and asset downloads. |
| githubToken? | string | GitHub token used to raise the API rate limit. Empty falls back to GITHUB_TOKEN or GH_TOKEN. |
| os? | string | Override the detected release OS token (e.g. Linux, Darwin). Empty probes the host with uname. |
| arch? | string | Override the detected release architecture token (e.g. x86_64, arm64). Empty probes the host with uname. |
| stem? | string | Required product name the asset file name must start with (e.g. 'tuios' or 'tuios-ghostty'). Empty matches any stem. |
| assetPattern? | string | Regular expression an archive asset's file name must match. Must define named groups (?<version>…), (?<os>…) and (?<arch>…); (?<stem>…) and (?<ext>…) are optional. |
| checksumsName? | string | Name of the release asset listing every archive's SHA-256. |
| format? | enum | Archive format: auto derives it from the file name; tar.gz, zip and raw force it. |
| Argument | Type | Description |
|---|---|---|
| checkRemaining? | boolean | Make one authenticated request to the releases API and report the |
| Argument | Type | Description |
|---|---|---|
| repos? | array | Repositories as owner/name. Duplicates are removed; the list is capped at |
| maxRepos? | number | Maximum repositories fetched in this call. |
| perRepo? | number | Releases read per repository (newest first). |
| ttlSeconds? | number | Reuse a repository's previous metadata when it was fetched within this |
| detectChannels? | boolean | Also report the LTS and development (prerelease) channels. |
| Argument | Type | Description |
|---|---|---|
| version? | string | Release version to resolve (e.g. 0.8.0 or v0.8.0). Empty resolves the latest release. |
| os? | string | Override the release OS token for this call (e.g. Linux). Empty uses the model global / host probe. |
| arch? | string | Override the release architecture token for this call (e.g. arm64). Empty uses the model global / host probe. |
| stem? | string | Override the required asset stem for this call. |
| assetName? | string | Force an exact archive file name instead of selecting by platform. |
| pattern? | string | Override the model's assetPattern for this call. |
| fetchChecksums? | boolean | Download the checksums file and record the selected archive's SHA-256. Set false to skip the extra request. |
| requireChecksum? | boolean | Fail when the selected archive's SHA-256 cannot be resolved. Set false to record the release unverified. |
| Argument | Type | Description |
|---|---|---|
| version? | string | Release version to download (e.g. 0.8.0). Empty downloads the latest release. |
| outputPath? | string | Exact absolute or ~-prefixed file path to write the verified archive to. Wins over outputDir. Empty (with outputDir empty too) downloads into memory only. |
| outputDir? | string | Directory to write the verified archive into, keeping the release's archive file name. Used when outputPath is empty. |
| assetName? | string | Force an exact archive file name to download, overriding platform selection. The bundled workflow supplies this from the release resource. |
| downloadUrl? | string | Archive URL resolved by `check`. When set with checksum and releaseVersion it avoids re-fetching the release. |
| releaseVersion? | string | The version `check` resolved, used to confirm downloadUrl matches the requested version. |
| checksum? | string | Expected 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? | string | Override the checksums file URL. Empty derives it from the release's assets. |
| os? | string | Override the release OS token for this call. |
| arch? | string | Override the release architecture token for this call. |
| stem? | string | Override the required asset stem for this call. |
| pattern? | string | Override the model's assetPattern for this call. |
| format? | enum | Override the archive format for this call. |
| requireChecksum? | boolean | Refuse to download when no SHA-256 can be resolved for the selected archive. |
| force? | boolean | Re-download even when outputPath already holds a file with the expected SHA-256. |
| Argument | Type | Description |
|---|---|---|
| includeBody? | boolean | Include the release notes body in the rendered Markdown. |
| includeAssets? | boolean | Include the asset table in the rendered Markdown. |
| maxBodyChars? | number | Truncate the release notes to this many characters. 0 keeps the full body. |
| Argument | Type | Description |
|---|---|---|
| installedVersion | preprocess |
Resources
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,
- 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
Spawns a subprocess with Deno.Command().
- models/github_release.ts:843 — `uname` and the optional `gh` CLI are the
- models/github_release.ts:1061 — `uname` is the platform probe; fixed argv.