From 017541574c35e59d6048c528711a5edbadf73411 Mon Sep 17 00:00:00 2001 From: Carlos Alexandro Becker Date: Mon, 16 Jan 2017 14:52:27 -0200 Subject: [PATCH] fail brew pipe if there is no darwin_amd64 build --- pipeline/brew/brew.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pipeline/brew/brew.go b/pipeline/brew/brew.go index ca2247d40..034e65196 100644 --- a/pipeline/brew/brew.go +++ b/pipeline/brew/brew.go @@ -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