- 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 -
So many ways to skin a cat.
Retrieving source files:
A shell script, incorporating authentication in order to access private repositories and use tag-name based retrieval to fetch a .tar from the latest release for when browser_download_url isn't available (browser_download_url won't be in the api output if only the standard tar and zip archives are available in your release).
Ensure jq is installed on the system running the script:
Retrieve binaries:
A shell script to fetch the latest release when binary files are available, in a private repository.
Ensure jq is installed.
Script may need modification if there is more than one binary file as at the moment it will only fetch the first.