Skip to content

GoReleaser: How To Distribute Your Binaries With Homebrew Or GoFish

This article is going to be a quick bite (or drink)! We going to discover, how fast we can create a Homebrew or GoFish deployment of our binaries with the help of GoReleaser.

But first, let us take a look into the concepts of the two package managers:

Homebrew 🍺

The Missing Package Manager for macOS (or Linux)

This statement is not from me, but from the official Homebrew website. Homebrew is similar to other package managers, like apt-get, aptitude, or dpkg. I will not go in this article into the details about Homebrew, but some terms are important to understand, as we going to use them in our .goreleaser.yaml file:

Tap: A Git repository of packages.

Formula: A software package. When we want to install new programs or libraries, we install a formula.

GoFish 🐠

GoFish, the Package Manager 🐠

GoFish is a cross-platform systems package manager, bringing the ease of use of Homebrew to Linux and Windows. Same as with Homebrew, I am not going into detail of GoFish but we need also here some understanding of the GoFish terminology:

Rig: A git repository containing fish food.

Food: The package definition

The example code

For each package manager, you should create its own GitHub repository. You can name it as you please, but i prefer to add the meaning of the repository.

  • goreleaser-rig for GoFish
  • goreleaser-tap for Homebrew

Add following snippet for GoFish support, to your existing .goreleaser.yaml:

rigs:
  - rig:
      owner: dirien
      name: goreleaser-rig
    homepage: "https://github.com/dirien/quick-bites"
    description: "Different type of projects, not big enough to warrant a separate repo."
    license: "Apache License 2.0"

And for Homebrew, add this little snippet:

brews:
  - tap:
      owner: dirien
      name: goreleaser-tap
    folder: Formula
    homepage: "https://github.com/dirien/quick-bites"
    description: "Different type of projects, not big enough to warrant a separate repo."
    license: "Apache License 2.0"

That’s all for now, and as usual with GoReleaser you can head over to the great documentation for more advanced settings:

https://goreleaser.com

Now run the release process and you will see this in your logs:

  β€’ homebrew tap formula
           β€’ pushing formula=Formula/goreleaser-brew-fish.rb repo=dirien/goreleaser-tap
  β€’ gofish fish food cookbook
           β€’ pushing food=Food/goreleaser-brew-fish.lua repo=dirien/goreleaser-rig

Perfect! Everything works as expected.

We can check the content on the GitHub UI.

Installation

Now we can add the tap and the rig on our clients

Homebrew

brew tap dirien/goreleaser-tap
brew install goreleaser-brew-fish

GoFish

gofish rig add https://github.com/dirien/goreleaser-rig
gofish install github.com/dirien/goreleaser-rig/goreleaser-brew-fish

The End

Now you can distribute this tap or rig repositories and everybody can install your projects via this package manager.

The Code

You can find the demo code in my repository, to see some more details: dirien/quick-bites.