Skip to content

Instantly share code, notes, and snippets.

@crazyuploader
Forked from lukechilds/get_latest_release.sh
Created January 7, 2021 10:44
Show Gist options
  • Select an option

  • Save crazyuploader/bef44ece53d97da70b29376662cc206f to your computer and use it in GitHub Desktop.

Select an option

Save crazyuploader/bef44ece53d97da70b29376662cc206f 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