1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-06 03:13:48 +02:00
Deliver Go binaries as fast and easily as possible https://goreleaser.com/
Go to file
2016-12-29 14:03:34 -02:00
brew improvements 2016-12-29 13:19:03 -02:00
build main.go should be in build section 2016-12-29 12:37:11 -02:00
compress fixes 2016-12-28 23:50:37 -02:00
config changed order 2016-12-29 14:03:17 -02:00
git fixed tag and shit 2016-12-29 09:00:03 -02:00
release added changelog to description 2016-12-29 14:03:34 -02:00
uname zip 2016-12-28 22:53:56 -02:00
.gitignore glide and travis 2016-12-28 23:30:14 -02:00
.travis.yml moving 2016-12-28 23:31:53 -02:00
glide.lock glide and travis 2016-12-28 23:30:14 -02:00
glide.yaml glide and travis 2016-12-28 23:30:14 -02:00
goreleaser.yml fixed releasing 2016-12-29 10:15:08 -02:00
LICENSE.md readme, license and shit 2016-12-28 22:55:23 -02:00
main.go brew release 2016-12-29 09:58:22 -02:00
README.md readme 2016-12-29 13:49:01 -02:00

Releaser

Builds go binaries for several platforms, creates a github release and then push it to a custom homebrew repository

How it works?

The idea started with a simple shell script, but it quickly became more complex and I also wanted to publish binaries via homebrew.

So, the all-new goreleaser was born.

Usage

Basically, you need to create a goreleaser.yml file in the root of your repository. A minimal config would look like this:

repo: user/repo
binary_name: my-binary

This will build main.go file as my-binary, for Darwin and Linux, x86_64 and i386, packaging the binary, LICENSE.md and README.md and publish a new github release in the user/repo repository with the .tar.gz files there.

Homebrew

To push it to a homebrew repo, just add a brew section:

repo: user/repo
binary_name: my-binary
brew:
  repo: user/homebrew-formulae
  caveats: "Optional caveats to add to the formulae"

Build customization

Just add a build section

repo: user/repo
binary_name: my-binary
build:
  main: ./cmd/main.go
  oses:
    - darwin
    - freebsd
  arches:
    - amd64

oses and arches should be in GOOS/GOARCH-compatible format.

Add more files

You might also want to change the files that are packaged by adding a files section:

repo: user/repo
binary_name: my-binary
files:
  - LICENSE.txt
  - README.md
  - CHANGELOG.md

Wire it with travis-ci

You may want to wire this to auto-deploy your new tags on travis, for examepl:

after_success:
  test ! -z "$TRAVIS_TAG" && curl -s https://raw.githubusercontent.com/goreleaser/get/master/latest | bash

How the end result looks like

The release on github looks pretty much like this:

image

And the homebrew formulae would look like:

class Antibody < Formula
  desc "A faster and simpler antigen written in Golang."
  homepage "http://getantibody.github.io"
  url "https://github.com/getantibody/antibody/releases/download/v2.2.2/antibody_#{%x(uname -s).gsub(/\n/, '')}_#{%x(uname -m).gsub(/\n/, '')}.tar.gz"
  head "https://github.com/getantibody/antibody.git"
  version "v2.2.2"

  def install
    bin.install "antibody"
  end

  def caveats
    "To start using antibody, you need to add `source <(antibody init)` to your `~/.zshrc`."
  end
end