- Use
curl
to get the JSON response for the latest release - Use
grep
to find the line containing file URL - Use
cut
andtr
to extract the URL - Use
wget
to download it
curl -s https://api.github.com/repos/jgm/pandoc/releases/latest \
| grep "browser_download_url.*deb" \
| cut -d : -f 2,3 \
| tr -d \" \
| wget -qi -
To download the latest tarball for a repo I was able to just do this:
curl https://api.github.com/repos/user/reponame/releases/latest | grep "browser_download_url" | grep -Eo 'https://[^\"]*' | xargs wget
I think if you are on Windows you have to change it to:
curl https://api.github.com/repos/user/reponame/releases/latest | grep "browser_download_url" | grep -Eo 'https://[^/"]*' | xargs wget
If you want to download the latest tar and immediately extract what was downloaded:
curl https://api.github.com/repos/user/reponame/releases/latest | grep "browser_download_url" | grep -Eo 'https://[^\"]*' | xargs wget -O - | tar -xz