GitHub Release Downloader
Download latest GitHub release binaries (for your OS/arch) using wget
or curl
wget --content-disposition https://getbin.io/suyashkumar/ssl-proxy
Overview
This is a simple server (deployed @ https://getbin.io) that makes it easy to download the latest binary associated with any GitHub repo release using regular old wget
and curl
. It attempts to use your User-Agent to fetch the right GitHub release asset for your OS/arch, but also lets you provide query parameters to specify OS/arch, and optionally uncompress the release artifact on the fly.
I mostly just built this as a way to distribute my software binaries easily without dealing with brew
, npm
, etc (though they certainly have their advantages & trust). I can just give my users a one line download link that will always get them the latest released binary for their platform, and all I have to do is just update GitHub releases like I normally do.
Basic functionality currently exists (with some assumptions, see below), but this is still a work in progress with many improvements forthcoming. This currently will work as expected with all of my repos/releases.
Usage
Let's say you wanted to get the latest suyashkumar/ssl-proxy
binary for your OS/arch. You simply:
wget -qO- https://getbin.io/suyashkumar/ssl-proxy | tar xvz
or with curl
you usually must specify your os (since it is not included in the User-Agent):
curl -LJ "https://getbin.io/suyashkumar/ssl-proxy?os=darwin" | tar xvz
Use with any* GitHub repo
The generalized request format is GET https://getbin.io/GITHUB_USERNAME/GITHUB_REPO
. See section below for assumptions.
Let's say we wanted the latest distribution of goreleaser/goreleaser
:
wget -qO- https://getbin.io/goreleaser/goreleaser | tar xvz
Generally, the server software attempts to detect your OS (and in the future, architecture) automatically from your User-Agent
, but also allows you to specify your own intentions as seen with curl
above. We're piping into tar
here because the original release assets are compressed, but you can also uncompress on the fly (see below)
Uncompress on the fly
If you want to not bother with piping into tar or zip as above, the server can decompress on the fly to serve you the binary (assuming it is the only file in the archive):
wget --content-disposition "https://getbin.io/suyashkumar/ssl-proxy?uncompress=true"
If your release asset is not compressed, you can simply:
wget --content-disposition "https://getbin.io/suyashkumar/ssl-proxy"
or
curl -LOJ "https://getbin.io/suyashkumar/ssl-proxy?os=darwin"
Notes & Assumptions
- If you are not using the inline uncompress feature, you'll notice that the server just transparently issues
wget
or curl
a 301 HTTP redirect to the proper GitHub artifact URL. This way you can have some faith the artifact is whatever was uploaded to that GitHub release.
- Currently, the OS is auto matched based on the supplied User-Agent.
curl
does not supply a user agent, so the query parameter os
must be supplied. The architecture is assumed to be amd64
/x86
.
- The GitHub release asset filename currently must contain (
darwin
, linux
, or windows
) and (x86
or amd64
). More to be expanded with this basic regex in the future. Probably will want to have all GOOS
and GOARCH
.
TODO
- Inline, automatic uncompression of binaries
- Handle GitHub preleases
- Handle different architectures without assumptions (currently assuming x86/amd64)
- Improved binary name matching regex
- Fetch specific tagged releases
Attribution
The terminal icon used above is made by Paomedia from iconfinder.com and is released under CC BY 3.0.