Skip to content

Instantly share code, notes, and snippets.

@actionjack
Forked from lukechilds/get_latest_release.sh
Created November 5, 2020 20:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save actionjack/59439db1f96b3af9e00553170e7b07d9 to your computer and use it in GitHub Desktop.
Save actionjack/59439db1f96b3af9e00553170e7b07d9 to your computer and use it in GitHub Desktop.
Shell - Get latest release from GitHub
get_latest_release() {
curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api
grep '"tag_name":' | # Get tag line
sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value
}
# Usage
# $ get_latest_release "creationix/nvm"
# v0.31.4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment