I can not find a way to build a command the downloads the latest version of webhook from GitHub releases. All links that I found are version-specific. Solution that Google uses is to publish version information during release process separately and use that to construct final download link.
This is how a download link for kubectl looks like:
curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s \
https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/darwin/amd64/kubectl
With https://storage.googleapis.com/kubernetes-release/release/stable.txt containing the latest stable version.
It might be possible to enable GitHub Pages for this repository and push latest released version info to it during release process.
You should be able to use the GitHub API to find the latest release.
This is the command that I use. How to call GitHub API there to get the 2.6.8 part?
curl -L https://github.com/adnanh/webhook/releases/download/2.6.8/webhook-linux-amd64.tar.gz | tar -xzO > /usr/local/bin/webhook
You can consult GitHub API documentation for the Releases API :-)
@adnanh took me half of an hour to get this magic spell. :D
sudo sh -c "curl -L $(curl -s https://api.github.com/repos/adnanh/webhook/releases/latest \
| grep -o -E "https://.+?-linux-amd64.tar.gz") | tar -xzO > /usr/local/bin/webhook \
&& chmod +x /usr/local/bin/webhook"
Most helpful comment
@adnanh took me half of an hour to get this magic spell. :D