Skip to content

gitea-release

Download and install tools from Gitea or Forgejo instance releases with automatic platform asset selection. Supports any Gitea-compatible instance including Codeberg, Forgejo, and self-hosted Gitea.

import { defineTool } from "@alexgorbatchev/dotfiles";
export default defineTool((install) =>
install("gitea-release", {
instanceUrl: "https://codeberg.org",
repo: "Codeberg/pages-server",
}).bin("pages-server"),
);
ParameterDescription
instanceUrlRequired. Base URL of the Gitea/Forgejo instance
repoRequired. Repository in “owner/repo” format
assetPatternGlob or regex pattern to match release assets. Optional. Use only if default automatic selection fails.
assetSelectorCustom function to select the correct asset. Optional. Use only if default automatic selection fails.
versionSpecific version (e.g., 'v1.2.3')
prereleaseInclude prereleases when fetching latest (default: false)
tokenAPI token for authentication with the instance
envEnvironment variables (static or dynamic function)

The installer uses built-in smart selection logic by default. It parses filenames and correctly matches combinations of OS and CPU architecture (e.g. linux/darwin/macos/win/windows + amd64/arm64/aarch64/x64/x86_64).

You should ONLY provide an assetPattern or assetSelector if the default selection logic fails to find a file or downloads the wrong asset.

install("gitea-release", {
instanceUrl: "https://codeberg.org",
repo: "owner/tool",
assetPattern: "*linux_amd64.tar.gz",
}).bin("tool");

Use assetSelector when the repository uses non-standard asset names or when you intentionally want something other than the default smart selector. Standard Linux gnu vs musl release names are handled automatically.

install("gitea-release", {
instanceUrl: "https://codeberg.org",
repo: "owner/tool",
assetSelector: ({ assets }) => {
return assets.find((a) => a.name.endsWith("-portable.tar.gz"));
},
}).bin("tool");
install("gitea-release", {
instanceUrl: "https://codeberg.org",
repo: "owner/tool",
version: "v2.1.0",
}).bin("tool");

For private repositories or to avoid rate limits:

install("gitea-release", {
instanceUrl: "https://gitea.example.com",
repo: "org/private-tool",
token: process.env.GITEA_TOKEN,
}).bin("tool");
PatternMatches
*linux*amd64*.tar.gzLinux x64 tarballs
*darwin*arm64*.zipmacOS ARM64 zips
*windows*.exeWindows executables

Glob syntax: * (any chars), ? (single char), [abc] (char class), {a,b} (alternation)

Regex patterns can also be used by wrapping in forward slashes: /tool-v\d+.*linux/

Available in assetSelector as systemInfo:

PropertyValues
platformdarwin, linux, win32
archx64, arm64
libcgnu, musl, unknown

Any server running the Gitea API v1 is supported:

  • Codeberg — Free hosting for open source projects
  • Forgejo — Community fork of Gitea
  • Gitea — Self-hosted Git service
  • Self-hosted instances