• This repository has been archived on 14/Jan/2022
  • Stars
    star
    442
  • Rank 94,912 (Top 2 %)
  • Language
    Go
  • License
    MIT License
  • Created almost 7 years ago
  • Updated almost 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

[DEPRECATED] Download Go binaries as fast and easily as possible.

Warning: this is no longer actively maintained.

See #161 for details.


GoReleaser Logo

GoDownloader

Download Go binaries as fast and easily as possible.

Software License Travis Go Report Card Go Doc Powered By: GoReleaser


This is the inverse of goreleaser. The goreleaser YAML file is read and creates a custom shell script that can download the right package and the right version for the existing machine.

If you use goreleaser already, this will create scripts suitable for "curl bash" style downloads.

This is also useful in CI/CD systems such as travis-ci.org.

  • Much faster then 'go get' (sometimes up to 100x)
  • Make sure your local environment (macOS) and the CI environment (Linux) are using the exact same versions of your go binaries.

CI/CD Example

Let's say you are using hugo, the static website generator, with travis-ci.

Your old .travis.yml file might have

install:
  - go get github.com/gohugoio/hugo

This can take up to 30 seconds!

Hugo doesn't have (yet) a godownloader.sh file. So we will make our own:

# create a godownloader script
godownloader --repo=gohugoio/hugo > ./godownloader-hugo.sh

and add godownloader-hugo.sh to your GitHub repo. Edit your .travis.yml as such

install:
  - ./godownloader-hugo.sh v0.37.1

Without a version number, GitHub is queried to get the latest version number.

install:
  - ./godownloader-hugo.sh

Typical download time is 0.3 seconds, or 100x improvement.

Your new hugo binary is in ./bin, so change your Makefie or scripts to use ./bin/hugo.

The default installation directory can be changed with the -b flag or the BINDIR environment variable.

Notes on Functionality

  • Only GitHub Releases are supported right now.
  • Checksums are checked.
  • Binares are installed using tar.gz or zip.
  • No OS-specific installs such as homebrew, deb, rpm. Everything is installed locally via a tar.gz or zip. Typically OS installs are done differently anyways (e.g. brew, apt-get, yum, etc).

Experimental support

Some people do not use Goreleaser (why!), so there is experimental support for the following alterative distributions.

"naked" releases on GitHub

A naked release is just the raw binary put on GitHub releases. Limited support can be done by

./goreleaser -source raw -repo [owner/repo] -exe [name] -nametpl [tpl]

Where exe is the final binary name, and tpl is the same type of name template that Goreleaser uses.

An example repo is at mvdan/sh. Note how the repo sh is different than the binary shfmt.

Equinox.io

Equinox.io is a really interesting platform. Take a look.

There is no API, so godownloader screen scrapes to figure out the latest release. Likewise, checksums are not verified.

./goreleaser -source equinoxio -repo [owner/repo]

While Equinox.io supports the concept of different release channels, only the stable channel is supported by godownloader.

Yes, it's true.

It's a go program that reads a YAML file that uses a template to make a posix shell script.

Other Resources and Inspiration

Other applications have written custom shell downloaders and installers:

golang/dep

The golang/dep package manager has a nice downloader, install.sh. Their trick to extract a version number from GitHub Releases is excellent:

$(echo "${LATEST_RELEASE}" | tr -s '\n' ' ' | sed 's/.*"tag_name":"//' | sed 's/".*//' )

This is probably based on masterminds/glide and its installer at https://glide.sh/get

kubernetes/helm

kubernetes/helm is a "tool for managing Kubernetes charts. Charts are packages of pre-configured Kubernetes resources."

It has a get script. Of note is that it won't re-install if the desired version is already present.

chef

Chef has the one of the most complete installers at https://omnitruck.chef.io/install.sh. In particular it has support for

  • Support for solaris and aix, and some other less common platforms
  • python or perl as installers if curl or wget isn't present
  • http proxy support

Caddy

Caddy is "the HTTP/2 web server with automatic HTTPS" and a NGINX replacement. It has a clever installer at https://getcaddy.com. Of note is GPG signature verification.

More Repositories

1

goreleaser

Deliver Go binaries as fast and easily as possible
Go
12,780
star
2

nfpm

nFPM is Not FPM - a simple deb, rpm, apk and arch linux packager written in Go
Go
1,965
star
3

goreleaser-action

GitHub Action for GoReleaser
TypeScript
791
star
4

chglog

chglog is a changelog management library and tool
Go
240
star
5

goreleaser-cross

Docker image for Golang cross-compiling with CGO
Shell
118
star
6

fileglob

A file globbing library.
Go
62
star
7

goreleaser-pro

Deliver Go binaries as fast, easily and pro as possible.
Go
53
star
8

goreleaser-example-supply-chain

Example goreleaser + github actions config with keyless signing and SBOM generation
Go
52
star
9

goreleaser-cross-example

Go
28
star
10

example

Example GoReleaser project
Go
26
star
11

goreleaser-example-zig-cgo

A showcase of using Zig to cross-compile Go application with GoReleaser
Go
25
star
12

homebrew-tap

Homebrew Formulae to @goreleaser binaries, powered by @goreleaser
Ruby
11
star
13

old-go-releaser

[DEPRECATED] A script to build and release go binaries to github releases
Shell
10
star
14

community

GoReleaser Community Resources
9
star
15

goreleaser-example-slsa-provenance

A demonstration of showing how to use ๐Ÿ’ƒSLSA 3 Generic Generator with GoReleaser to release artifacts while generating signed SLSA provenance
Go
9
star
16

get

Get the latest goreleaser binary
Shell
8
star
17

archive

Moved to https://github.com/goreleaser/goreleaser/tree/master/pkg/archive
Go
5
star
18

scoop-bucket

Scoop bucket for @goreleaser binaries, powered by @goreleaser
5
star
19

goinstall

[DEPRECATED] curl | bash goreleaser projects
Shell
4
star
20

goreleaser-pro-split-merge-example

Example repository using the upcoming split/merge feature of @goreleaser pro
Dockerfile
4
star
21

goreleaser-azure-devops-extension

Azure DevOps Extension for GoReleaser
TypeScript
3
star
22

artwork

logos & art
3
star
23

.github

Smarty
3
star
24

goreleaser-pro-split-merge-example-real

Example repository using the upcoming split/merge feature of @goreleaser pro to build windows docker images
Dockerfile
3
star
25

fish-food

Gofish Rigs to @goreleaser binaries, powered by @goreleaser
Lua
2
star
26

users

graphs GoReleaser usage in the wild
Go
2
star
27

nur

nix user repository for goreleaser
Nix
2
star
28

goreleaser-cross-toolchains

Dockerfile
2
star
29

goreleaser-pro-monorepo-example

GoReleaser Pro Monorepo example with GitHub Actions
Go
2
star
30

example-mod-proxy

Example of project using @goreleaser's gomod.proxy feature.
Go
2
star
31

example-simple

Probably the simplest possible @goreleaser example
Makefile
1
star
32

goreleaser-example-sign-with-env

Example signing with cosign using --key=env://KEY
Go
1
star
33

tf

Terraform resources for GoReleaser's organization
HCL
1
star
34

acceptance-tests

Acceptance tests setup et al for GoReleaser.
Shell
1
star