Skip to main content

CLI helper to install Github releases on your system.

Project description

Github release installer

CI PyPI Python Versions PyPI Package Version

gh-release-install is a CLI helper to install Github releases on your system. It can be used for pretty much anything, to install a formatter in your CI, deploy some binary using an orcherstration tool, or on your desktop.

This project was mainly created to...

# ...turn this mess:
wget --quiet --output-document=- "https://github.com/koalaman/shellcheck/releases/download/v0.7.1/shellcheck-v0.7.1.linux.x86_64.tar.xz" \
    | tar --extract --xz --directory=/usr/local/bin --strip-components=1 --wildcards 'shellcheck*/shellcheck' \
    && chmod +x /usr/local/bin/shellcheck

wget --quiet --output-document=/usr/local/bin/shfmt "https://github.com/mvdan/sh/releases/download/v3.2.1/shfmt_v3.2.1_linux_amd64" \
    && chmod +x /usr/local/bin/shfmt

# Into this:
pip3 install gh-release-install

gh-release-install \
      "koalaman/shellcheck" \
      "shellcheck-{tag}.linux.x86_64.tar.xz" --extract "shellcheck-{tag}/shellcheck" \
      "/usr/bin/shellcheck"

gh-release-install \
      "mvdan/sh" \
      "shfmt_{tag}_linux_amd64" \
      "/usr/bin/shfmt"

Features:

  • Download releases from Github.
  • Extract zip or tarball on the fly.
  • Pin to a desired version or get the latest version.
  • Keep track of the local tools version using a version file.

Installation

Install the package from pip:

pip install gh-release-install
gh-release-install --help

Or with with pipx:

pipx install gh-release-install
gh-release-install --help

Usage

usage: gh-release-install [-h] [--extract <filename>] [--version <version>]
                          [--version-file <filename>]
                          [--checksum <hash>:<digest|asset>] [-v] [-q]
                          REPOSITORY ASSET DESTINATION

Install GitHub release file on your system.

positional arguments:
  REPOSITORY            Github REPOSITORY org/repo to get the release from.
  ASSET                 Release ASSET filename. May contain variables such as
                        '{version}' or '{tag}'.
  DESTINATION           Path to save the downloaded file. If DESTINATION is a
                        directory, the asset name will be used as filename in
                        that directory. May contain variables such as
                        '{version}' or '{tag}'.

optional arguments:
  -h, --help            show this help message and exit
  --extract <filename>  Extract the <filename> from the release asset archive
                        and install the extracted file instead. May contain
                        variables such as '{version}' or '{tag}'. (default:
                        None)
  --version <version>   Desired release version to install. When using 'latest'
                        the installer will guess the latest version from the
                        Github API. (default: latest)
  --version-file <filename>
                        Track the version installed on the system using a file.
                        May contain variables such as '{destination}'. (default:
                        None)
  --checksum <hash>:<digest|asset>
                        Asset checksum used to verify the downloaded ASSET.
                        <hash> can be one of md5, sha1, sha224, sha256, sha384,
                        sha512. <digest|asset> can either be the expected
                        checksum, or the filename of an checksum file in the
                        release assets. (default: None)
  -v, --verbose         Increase the verbosity. (default: 0)
  -q, --quiet           Disable logging. (default: None)

template variables:
    {tag}               Release tag name.
    {version}           Release tag name without leading 'v'.
    {destination}       DESTINATION path, including the asset filename if path
                        is a directory.

examples:
    gh-release-install 'mvdan/sh' \
        'shfmt_{tag}_linux_amd64' \
        '/usr/local/bin/shfmt' \
        --version 'v3.3.1'

    gh-release-install 'prometheus/prometheus' \
        'prometheus-{version}.linux-amd64.tar.gz' \
        --extract 'prometheus-{version}.linux-amd64/prometheus' \
        '/usr/local/bin/prometheus' \
        --version-file '{destination}.version' \
        --checksum 'sha256:sha256sums.txt'

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gh_release_install-0.11.2.tar.gz (19.5 kB view details)

Uploaded Source

Built Distribution

gh_release_install-0.11.2-py3-none-any.whl (20.9 kB view details)

Uploaded Python 3

File details

Details for the file gh_release_install-0.11.2.tar.gz.

File metadata

  • Download URL: gh_release_install-0.11.2.tar.gz
  • Upload date:
  • Size: 19.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.10.12 Linux/6.5.0-1025-azure

File hashes

Hashes for gh_release_install-0.11.2.tar.gz
Algorithm Hash digest
SHA256 b7a03c0564f86f75ef0a8029a6d3b1ecbb956da22a5df15851df0b65916b6505
MD5 e758731ed9a5e3d4de0269a67fab1da2
BLAKE2b-256 4c22d8aab7546c37f89ecf0bd76782e8baf40ec0370a9622b8f0a0f670dd9108

See more details on using hashes here.

File details

Details for the file gh_release_install-0.11.2-py3-none-any.whl.

File metadata

File hashes

Hashes for gh_release_install-0.11.2-py3-none-any.whl
Algorithm Hash digest
SHA256 16ce722c4dc5b3dd23a85f06053170dfe499e65dbd77ed00e3588b56ce5e8ee7
MD5 cbcca8809b96635f98b312915d41677a
BLAKE2b-256 3a9bca4673f6ba6dfa9913f7e5fec41cb86cf2e2aeb5ce9f08a655a608d537be

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page