# 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: ```bash ./github-release-installer [options] "owner/repo" ``` Examples: ```bash # 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 `: choose an exact asset name. - `-t, --type `: filter by asset type. - `-b, --binary-name `: install binary using optional destination name. - `-a, --app-name `: set application display name. - `-o, --output-directory `: download only, do not install. - `-j, --releases-json`: download latest release metadata as JSON. - `-h, --help`: show usage help. For full help: ```bash ./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=1` to run without downloading/installing. - `OUTPUT_DIR='/tmp'` to download only. - `SYSTEM` and `ARCH` to override platform detection. ```bash 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" ```