Is there a link to GitHub for downloading a file in the latest release of a repository?

前端 未结 18 2274
情深已故
情深已故 2020-12-02 04:26

Using GitHub\'s Release feature, it is possible to provide a link to download a specific version of the published software. However, every time a release is made, the gh-pag

18条回答
  •  北海茫月
    2020-12-02 05:11

    Another Linux solution using curl and wget to download a single binary file from the latest release page

    curl -s -L https://github.com/bosun-monitor/bosun/releases/latest | egrep -o '/bosun-monitor/bosun/releases/download/[0-9]*/scollector-linux-armv6' | wget --base=http://github.com/ -i - -O scollector
    

    Explanation:

    curl -s -L is to silently download the latest release HTML (after following redirect)

    egrep -o '...' uses regex to find the file you want

    wget --base=http://github.com/ -i - converts the relative path from the pipeline to absolute URL

    and -O scollector sets the desired file name.

    may be able to add -N to only download if the file is newer but S3 was giving a 403 Forbidden error.

提交回复
热议问题