Giter VIP home page Giter VIP logo

ghi's Introduction

ghi

ghi retrieve and install software from a GitHub release downloadable assets.

Installation

Clone this repository somewhere and put this script in your PATH.

git clone [email protected]:archf/ghi.git

This script needs to be placed in the sudoers 'secure_path' to allow for priviledged mode execution and thus installation of archives (.deb) and/or unpacking of tarballs in some paths.

Quickly create that symlink in /usr/local/bin:

sudo make install

Uninstallation

sudo make uninstall

Usage

No repositories specified, defaulting to current project repository.
GHI
  A custom git command to install software from a github release.
  See https://github.com/archf/git-pkg.

Limitations
Using the 'latest' release will only work if the release is not tagged as a
'draft' or 'prerelease'.

USAGE
  ghi [OPTIONS] CMD [PATTERN]

OPTIONS
  -h|--help       Show this help menu.
  -t|--tag        Output latest release 'tag_name' and exit.
  -r|--repository Set Github repository in the '<user|org>/<repository_name>'
                  Defaults to use .git/config file.
                  setting in your project directory.
  --assets-dir    Directory where to download archives. Defaults to '~/.ghi'.
                  This allows for later easy removal of installed software.
  -p|--prefix     Directory where to unpack a tar archive. Defaults to
                  '/usr/local' when this script is ran in priviledged mode,
                  '~/' otherwise.  If the tar contains a standalone binary
                  executable one would tipically set this to
                  '/usr/local/bin' or '~/bin'.
  -v|--verbose

CMD
  install     Install/unpack software from downloadable assets.
  search      Search for assets
  help        Show this help menu.

Search all assets of latest release

> ghi search --repository sharkdp/hyperfine
https://github.com/sharkdp/hyperfine/releases/download/v1.6.0/hyperfine-musl_1.6.0_amd64.deb
https://github.com/sharkdp/hyperfine/releases/download/v1.6.0/hyperfine-musl_1.6.0_i386.deb
https://github.com/sharkdp/hyperfine/releases/download/v1.6.0/hyperfine-v1.6.0-i686-unknown-linux-gnu.tar.gz
https://github.com/sharkdp/hyperfine/releases/download/v1.6.0/hyperfine-v1.6.0-i686-unknown-linux-musl.tar.gz
https://github.com/sharkdp/hyperfine/releases/download/v1.6.0/hyperfine-v1.6.0-x86_64-apple-darwin.tar.gz
https://github.com/sharkdp/hyperfine/releases/download/v1.6.0/hyperfine-v1.6.0-x86_64-pc-windows-msvc.zip
https://github.com/sharkdp/hyperfine/releases/download/v1.6.0/hyperfine-v1.6.0-x86_64-unknown-linux-gnu.tar.gz
https://github.com/sharkdp/hyperfine/releases/download/v1.6.0/hyperfine-v1.6.0-x86_64-unknown-linux-musl.tar.gz
https://github.com/sharkdp/hyperfine/releases/download/v1.6.0/hyperfine_1.6.0_amd64.deb
https://github.com/sharkdp/hyperfine/releases/download/v1.6.0/hyperfine_1.6.0_i386.deb

Search for assets matching specific PATTERN

> ghi search --repository sharkdp/hyperfine deb

https://github.com/sharkdp/hyperfine/releases/download/v1.6.0/hyperfine-musl_1.6.0_amd64.deb
https://github.com/sharkdp/hyperfine/releases/download/v1.6.0/hyperfine-musl_1.6.0_i386.deb
https://github.com/sharkdp/hyperfine/releases/download/v1.6.0/hyperfine_1.6.0_amd64.deb
https://github.com/sharkdp/hyperfine/releases/download/v1.6.0/hyperfine_1.6.0_i386.deb

Installing a specific archive

> ./ghi install -r fgeller/kt
Error: too many possible asset to download. Current matches are:

https://github.com/fgeller/kt/releases/download/v12.1.0/kt-v12.1.0-darwin-amd64.txz
https://github.com/fgeller/kt/releases/download/v12.1.0/kt-v12.1.0-linux-amd64.txz

Consider using a more specific asset filtering PATTERN than '.*'.

Now if we input a filtering PATTERN

> ghi install -r fgeller/kt 'linux-amd64.txz'
Installing
https://github.com/fgeller/kt/releases/download/v12.1.0/kt-v12.1.0-linux-amd64.txz
from repository 'fgeller/kt'

Get latest release's tag

> ghi search --tag --repository sharkdp/hyperfine
v1.6.0

TODO

  • choosing a release other than latest
  • handle tarbals containing a directory and/or multiple files
  • add a show command to list content of downloaded archives
  • handle rpms

Other tools worth mentioning

This is inpired heavily from ghr, a tool doing the reverse operation, i.e: create a GitHub Release and upload artifacts in parallel.

Other notable tools:

  • hub - a git wrapper that makes git easier to use with GitHub
  • github-release
  • gothub (a fork of aktau/gitub-release)

ghi's People

Contributors

archf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

dtorner eliezio

ghi's Issues

Installion| Public Key - Permission Denied

Hello, I tried installing ghi but ran with an issue of getting permission denied based off of the public key:

Cloning into 'ghi'...
Warning: Permanently added the RSA host key for IP address '140.82.121.4' to the list of known hosts.
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Could you please help me solve this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.