- 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 -
curl -s https://api.github.com/repos/jgm/pandoc/releases/latest
| grep "browser_download_url.*deb"
| cut -d '"' -f 4
| wget -qi -
Wildcard didn't work on Docker ubuntu:latest
But this did. just broke out the greps.
curl -s https://api.github.com/repos/mozilla/geckodriver/releases/latest
| grep browser_download_url
| grep linux64
| cut -d '"' -f 4
| wget -qi -
Shorter PCRE grep: (just get's the version number) curl -s https://api.github.com/repos/USER/REPO/releases/latest | grep -oP '"tag_name": "\K(.*)(?=")' curl -sL https://api.github.com/repos/USER/REPO/releases/latest | jq -r '.assets[].browser_download_url'
curl -s https://api.github.com/repos/USER/REPO/releases/latest | jq -r ".assets[] | select(.name | contains("search param for specific download url")) | .browser_download_url" | wget -i -
curl --silent "https://api.github.com/repos/USER/REPO/releases/latest" | # Get latest release from GitHub api grep '"tag_name":' | # Get tag line sed -E 's/."([^"]+)"./\1/' | xargs -I {} curl -sOL "https://github.com/USER/REPO/archive/"{}'.tar.gz'