1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-07-15 01:34:21 +02:00

trying with test fixtures

This commit is contained in:
Carlos Alexandro Becker
2017-04-15 13:58:18 -03:00
parent 36efad3f78
commit 0b7936eb0d
7 changed files with 71 additions and 28 deletions

View File

@ -3,6 +3,7 @@
package git
import (
"log"
"os"
"regexp"
"strings"
@ -37,6 +38,7 @@ func (p Pipe) Run(ctx *context.Context) (err error) {
}
func (Pipe) doRun(ctx *context.Context, pwd string) (err error) {
log.Println("git:", pwd)
tag, err := cleanGit(pwd, "describe", "--tags", "--abbrev=0", "--always")
if err != nil {
return
@ -56,16 +58,16 @@ func (Pipe) doRun(ctx *context.Context, pwd string) (err error) {
PreviousTag: prev,
Diff: log,
}
// removes usual `v` prefix
ctx.Version = strings.TrimPrefix(tag, "v")
if versionErr := isVersionValid(ctx.Version); versionErr != nil {
return versionErr
}
commit, err := cleanGit(pwd, "show", "--format='%H'", "HEAD")
if err != nil {
return
}
ctx.Git.Commit = commit
// removes usual `v` prefix
ctx.Version = strings.TrimPrefix(tag, "v")
if versionErr := isVersionValid(ctx.Version); versionErr != nil {
return versionErr
}
return
}