Webhook: Command to download latest webhook version

Created on 8 Nov 2018  路  4Comments  路  Source: adnanh/webhook

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.

Most helpful comment

@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"

All 4 comments

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"
Was this page helpful?
0 / 5 - 0 ratings

Related issues

wranitzky picture wranitzky  路  6Comments

MichelDiz picture MichelDiz  路  5Comments

scalp42 picture scalp42  路  4Comments

Gareth-3aaa picture Gareth-3aaa  路  4Comments

avtar picture avtar  路  6Comments