1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-02-05 13:15:26 +02:00

Merge pull request #84 from goreleaser/brew-fail-no-darwin

fail brew pipe if there is no darwin_amd64 build
This commit is contained in:
Carlos Alexandro Becker 2017-01-16 19:06:16 -02:00 committed by GitHub
commit 8cd2016d76

View File

@ -2,6 +2,7 @@ package brew
import (
"bytes"
"errors"
"log"
"path/filepath"
"strings"
@ -13,6 +14,10 @@ import (
"github.com/goreleaser/goreleaser/sha256sum"
)
// ErrNoDarwin64Build when there is no build for darwin_amd64 (goos doesn't
// contain darwin and/or goarch doesn't contain amd64)
var ErrNoDarwin64Build = errors.New("brew tap requires a darwin amd64 build")
const formulae = `class {{ .Name }} < Formula
desc "{{ .Desc }}"
homepage "{{ .Homepage }}"
@ -112,6 +117,9 @@ func dataFor(ctx *context.Context, client *github.Client) (result templateData,
return
}
file := ctx.Archives["darwinamd64"]
if file == "" {
return result, ErrNoDarwin64Build
}
sum, err := sha256sum.For("dist/" + file + "." + ctx.Config.Archive.Format)
if err != nil {
return