Skip to content

Instantly share code, notes, and snippets.

@corvax19
Forked from lukechilds/get_latest_release.sh
Created January 30, 2022 10:31
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 corvax19/0638b904d0a789d0ce960821bcc42e43 to your computer and use it in GitHub Desktop.
Save corvax19/0638b904d0a789d0ce960821bcc42e43 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
@corvax19
Copy link
Author

nice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment