2017-01-14 12:34:22 -02:00
|
|
|
package git
|
|
|
|
|
2017-01-14 20:01:32 -02:00
|
|
|
import "github.com/goreleaser/goreleaser/context"
|
2017-01-14 12:34:22 -02:00
|
|
|
|
|
|
|
// Pipe for brew deployment
|
|
|
|
type Pipe struct{}
|
|
|
|
|
2017-01-14 19:41:32 +01:00
|
|
|
// Description of the pipe
|
2017-01-14 15:14:35 -02:00
|
|
|
func (Pipe) Description() string {
|
2017-01-19 10:04:41 +01:00
|
|
|
return "Getting Git info"
|
2017-01-14 12:34:22 -02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Run the pipe
|
2017-01-14 14:06:57 -02:00
|
|
|
func (Pipe) Run(ctx *context.Context) (err error) {
|
2017-01-14 12:34:22 -02:00
|
|
|
tag, err := currentTag()
|
|
|
|
if err != nil {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
previous, err := previousTag(tag)
|
|
|
|
if err != nil {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
log, err := log(previous, tag)
|
|
|
|
if err != nil {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2017-01-14 14:06:57 -02:00
|
|
|
ctx.Git = &context.GitInfo{
|
|
|
|
CurrentTag: tag,
|
|
|
|
PreviousTag: previous,
|
|
|
|
Diff: log,
|
|
|
|
}
|
2017-01-14 12:34:22 -02:00
|
|
|
return
|
|
|
|
}
|