mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-03-17 20:47:50 +02:00
improved logging
This commit is contained in:
parent
ce7a2227a0
commit
bbaabd7c37
@ -53,7 +53,7 @@ func (ctx *Context) AddArtifact(file string) {
|
||||
defer artifactsLock.Unlock()
|
||||
file = strings.TrimPrefix(file, ctx.Config.Dist+string(filepath.Separator))
|
||||
ctx.Artifacts = append(ctx.Artifacts, file)
|
||||
log.WithField("artifact", file).Info("new artifact")
|
||||
log.WithField("artifact", file).Info("new release artifact")
|
||||
}
|
||||
|
||||
// AddBinary adds a built binary to the current context
|
||||
@ -77,7 +77,7 @@ func (ctx *Context) AddBinary(platform, folder, name, path string) {
|
||||
WithField("folder", folder).
|
||||
WithField("name", name).
|
||||
WithField("path", path).
|
||||
Info("new binary")
|
||||
Debug("new binary")
|
||||
}
|
||||
|
||||
// New context
|
||||
|
@ -84,13 +84,7 @@ func Release(flags Flags) error {
|
||||
ctx.RmDist = flags.Bool("rm-dist")
|
||||
for _, pipe := range pipes {
|
||||
log.Infof("\033[1m%s\033[0m", strings.ToUpper(pipe.Description()))
|
||||
var err = pipe.Run(ctx)
|
||||
if err == nil {
|
||||
continue
|
||||
}
|
||||
if skip, ok := err.(pipeline.ErrSkip); ok {
|
||||
log.WithField("reason", skip.Error()).Warn("skipped")
|
||||
} else {
|
||||
if err := handle(pipe.Run(ctx)); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
@ -98,6 +92,18 @@ func Release(flags Flags) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func handle(err error) error {
|
||||
if err == nil {
|
||||
return nil
|
||||
}
|
||||
skip, ok := err.(pipeline.ErrSkip)
|
||||
if ok {
|
||||
log.WithField("reason", skip.Error()).Warn("skipped")
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
// InitProject creates an example goreleaser.yml in the current directory
|
||||
func InitProject(filename string) error {
|
||||
if _, err := os.Stat(filename); !os.IsNotExist(err) {
|
||||
|
@ -10,12 +10,12 @@ func All(build config.Build) (targets []Target) {
|
||||
for _, target := range allBuildTargets(build) {
|
||||
if !valid(target) {
|
||||
log.WithField("target", target.PrettyString()).
|
||||
Warn("skipped invalid build")
|
||||
Debug("skipped invalid build")
|
||||
continue
|
||||
}
|
||||
if ignored(build, target) {
|
||||
log.WithField("target", target.PrettyString()).
|
||||
Warn("skipped ignored build")
|
||||
Debug("skipped ignored build")
|
||||
continue
|
||||
}
|
||||
targets = append(targets, target)
|
||||
|
@ -27,7 +27,7 @@ func (Pipe) Run(ctx *context.Context) (err error) {
|
||||
return nil
|
||||
}
|
||||
if ctx.RmDist {
|
||||
log.Info("rm-dist is set, removing ./dist")
|
||||
log.Info("--rm-dist is set, removing ./dist")
|
||||
return os.RemoveAll(ctx.Config.Dist)
|
||||
}
|
||||
files, err := ioutil.ReadDir(ctx.Config.Dist)
|
||||
|
Loading…
x
Reference in New Issue
Block a user