1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-07-03 00:57:43 +02:00

refactor: unifying snapshot with skip-validate and skip-publish (#575)

* refactor: removed goreleaserlib: moved all to main

* refactor: wip: snapshot

* fix: more pipes

* fix: more pipes

* fix: git tests

* fix: some other validate and publish usages

* fix: git dirty check when snapshoting

* fix: nfpm: use tag instead of version

* test: docker: print docker run output if registry fails
This commit is contained in:
Carlos Alexandro Becker
2018-02-24 17:59:08 -03:00
committed by GitHub
parent 2bb509f5a8
commit fdc032ec15
24 changed files with 113 additions and 242 deletions

View File

@ -10,7 +10,6 @@ import (
"github.com/apex/log"
"github.com/goreleaser/goreleaser/context"
"github.com/goreleaser/goreleaser/internal/git"
"github.com/goreleaser/goreleaser/pipeline"
"github.com/pkg/errors"
)
@ -38,9 +37,6 @@ func (Pipe) Run(ctx *context.Context) (err error) {
if err = setVersion(ctx, tag, commit); err != nil {
return
}
if !ctx.Validate {
return pipeline.Skip("--skip-validate is set")
}
return validate(ctx, commit, tag)
}
@ -80,13 +76,13 @@ func getSnapshotName(ctx *context.Context, tag, commit string) (string, error) {
}
func validate(ctx *context.Context, commit, tag string) error {
if ctx.Snapshot {
return nil
}
out, err := git.Run("status", "--porcelain")
if strings.TrimSpace(out) != "" || err != nil {
return ErrDirty{out}
}
if ctx.Snapshot {
return nil
}
if !regexp.MustCompile("^[0-9.]+").MatchString(ctx.Version) {
return ErrInvalidVersionFormat{ctx.Version}
}