Created
July 22, 2021 01:27
-
-
Save syohex/836210485d50c7fec6e419bcb08fe292 to your computer and use it in GitHub Desktop.
update gh script on Linux environment
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -e | |
set -x | |
VERSION=$1 | |
if [[ $VERSION == "" ]]; then | |
echo "Usage: update-gh version" | |
exit 1 | |
fi | |
BASE="gh_${VERSION}_linux_amd64.tar.gz" | |
DIR="gh_${VERSION}_linux_amd64" | |
URL="https://github.com/cli/cli/releases/download/v${VERSION}/gh_${VERSION}_linux_amd64.tar.gz" | |
curl -LO $URL | |
tar xf $BASE | |
cp ${DIR}/bin/gh ~/bin/gh | |
chmod +x ~/bin/gh | |
rm -rf "$DIR" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment