94ccb5304994deb9ae927b1e0ecec07772b44c42
All checks were successful
Validate Script / test (push) Successful in 5s
Github Release Installer Bash Script
The github-release-installer is a bash script that allows you to easily download and install assets from GitHub releases. It supports various options for customizing the installation process, such as specifying the release version, filtering assets by name, and performing dry runs.
Usage
Run the script with a GitHub repository in owner/repo format:
./github-release-installer [options] "owner/repo"
Examples:
# Install latest matching release asset for the current OS/arch
./github-release-installer cli/cli
# Preview what would be selected without downloading/installing
./github-release-installer --dry-run cli/cli
# List downloadable assets from the latest release
./github-release-installer --list cli/cli
# Install using explicit app and binary names
./github-release-installer --app-name "GitHub CLI" --binary-name gh cli/cli
# Download a specific asset file to a directory (no install)
./github-release-installer --file-name gh_2.70.0_macOS_arm64.zip --output-directory /tmp cli/cli
Useful options:
--dry-run [level]: test mode, print what would happen.-l, --list: print release asset URLs.-f, --file-name <name>: choose an exact asset name.-t, --type <archive|package|zip|tar.gz|tgz|deb|pkg|rpm>: filter by asset type.-b, --binary-name <src[:dest]>: install binary using optional destination name.-a, --app-name <name>: set application display name.-o, --output-directory <dir>: download only, do not install.-j, --releases-json: download latest release metadata as JSON.-h, --help: show usage help.
For full help:
./github-release-installer --help
Function usage (when sourced)
If the script is sourced from another installer script, call github_release_installer directly.
Use environment variables to set options, for example:
ASSET_TYPE='\.tar\.gz$'to filter for tar.gz assets.ASSET_NAME='gh_2.70.0_macOS_arm64.zip'to pick an exact file.TEST_MODE=1to run without downloading/installing.OUTPUT_DIR='/tmp'to download only.SYSTEMandARCHto override platform detection.
source "$(dirname "$0")/github-release-installer"
ASSET_TYPE='\.tar\.gz$'
github_release_installer "Databricks CLI" "databricks" "databricks/cli"
# Pick a specific asset by exact filename
ASSET_NAME='gh_2.70.0_macOS_arm64.zip'
github_release_installer "GitHub CLI" "gh" "cli/cli"
# Dry-run mode (no side effects)
TEST_MODE=1
github_release_installer "GitHub CLI" "gh" "cli/cli"
# Download only (no install)
OUTPUT_DIR='/tmp'
github_release_installer "GitHub CLI" "gh" "cli/cli"
# Override platform detection
SYSTEM='linux'
ARCH='x86_64'
github_release_installer "GitHub CLI" "gh" "cli/cli"
Languages
Shell
100%