mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-02-09 13:36:56 +02:00
debug, warning etc
This commit is contained in:
parent
1e9e82d926
commit
0d760731a1
@ -44,6 +44,9 @@ type Flags interface {
|
||||
func Release(flags Flags) error {
|
||||
var file = flags.String("config")
|
||||
var notes = flags.String("release-notes")
|
||||
if flags.Bool("debug") {
|
||||
log.SetLevel(log.DebugLevel)
|
||||
}
|
||||
cfg, err := config.Load(file)
|
||||
if err != nil {
|
||||
// Allow file not found errors if config file was not
|
||||
|
6
main.go
6
main.go
@ -5,7 +5,7 @@ import (
|
||||
"os"
|
||||
|
||||
"github.com/apex/log"
|
||||
lcli "github.com/apex/log/handlers/cli"
|
||||
lcli "github.com/apex/log/handlers/text"
|
||||
"github.com/goreleaser/goreleaser/goreleaserlib"
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
@ -47,6 +47,10 @@ func main() {
|
||||
Name: "snapshot",
|
||||
Usage: "Generate an unversioned snapshot release",
|
||||
},
|
||||
cli.BoolFlag{
|
||||
Name: "debug",
|
||||
Usage: "Enable debug mode",
|
||||
},
|
||||
}
|
||||
app.Action = func(c *cli.Context) error {
|
||||
log.Infof("Running goreleaser %v", version)
|
||||
|
@ -95,15 +95,15 @@ func (Pipe) Run(ctx *context.Context) error {
|
||||
|
||||
func doRun(ctx *context.Context, client client.Client) error {
|
||||
if !ctx.Publish {
|
||||
log.Info("Skipped because --skip-publish is set")
|
||||
log.Warn("Skipped because --skip-publish is set")
|
||||
return nil
|
||||
}
|
||||
if ctx.Config.Brew.GitHub.Name == "" {
|
||||
log.Info("Skipped because brew section is not configured")
|
||||
log.Warn("Skipped because brew section is not configured")
|
||||
return nil
|
||||
}
|
||||
if ctx.Config.Release.Draft {
|
||||
log.Info("Skipped because release is marked as draft")
|
||||
log.Warn("Skipped because release is marked as draft")
|
||||
return nil
|
||||
}
|
||||
path := filepath.Join(ctx.Config.Brew.Folder, ctx.Config.Build.Binary+".rb")
|
||||
|
@ -81,15 +81,14 @@ func build(ctx *context.Context, name string, target buildTarget) error {
|
||||
}
|
||||
|
||||
func run(target buildTarget, command, env []string) error {
|
||||
cmd := exec.Command(command[0], command[1:]...)
|
||||
var cmd = exec.Command(command[0], command[1:]...)
|
||||
env = append(env, "GOOS="+target.goos, "GOARCH="+target.goarch, "GOARM="+target.goarm)
|
||||
cmd.Env = append(cmd.Env, os.Environ()...)
|
||||
cmd.Env = append(cmd.Env, env...)
|
||||
cmd.Env = append(
|
||||
cmd.Env,
|
||||
"GOOS="+target.goos,
|
||||
"GOARCH="+target.goarch,
|
||||
"GOARM="+target.goarm,
|
||||
)
|
||||
log.WithField("target", target.PrettyString()).
|
||||
WithField("env", env).
|
||||
WithField("args", cmd.Args).
|
||||
Debug("Running")
|
||||
if out, err := cmd.CombinedOutput(); err != nil {
|
||||
return fmt.Errorf("build failed: %s\n%v", target.PrettyString(), string(out))
|
||||
}
|
||||
|
@ -26,11 +26,11 @@ func (t buildTarget) PrettyString() string {
|
||||
func buildTargets(ctx *context.Context) (targets []buildTarget) {
|
||||
for _, target := range allBuildTargets(ctx) {
|
||||
if !valid(target) {
|
||||
log.WithField("target", target.PrettyString()).Info("Skipped invalid build")
|
||||
log.WithField("target", target.PrettyString()).Warn("Skipped invalid build")
|
||||
continue
|
||||
}
|
||||
if ignored(ctx, target) {
|
||||
log.WithField("target", target.PrettyString()).Info("Skipped ignored build")
|
||||
log.WithField("target", target.PrettyString()).Warn("Skipped ignored build")
|
||||
continue
|
||||
}
|
||||
targets = append(targets, target)
|
||||
|
@ -27,7 +27,7 @@ func (Pipe) Run(ctx *context.Context) error {
|
||||
|
||||
func doRun(ctx *context.Context, client client.Client) error {
|
||||
if !ctx.Publish {
|
||||
log.Info("Skipped because --skip-publish is set")
|
||||
log.Warn("Skipped because --skip-publish is set")
|
||||
return nil
|
||||
}
|
||||
log.WithField("tag", ctx.Git.CurrentTag).
|
||||
|
Loading…
x
Reference in New Issue
Block a user