2017-01-14 16:34:22 +02:00
|
|
|
package git
|
|
|
|
|
2017-01-15 00:01:32 +02:00
|
|
|
import "github.com/goreleaser/goreleaser/context"
|
2017-01-14 16:34:22 +02:00
|
|
|
|
|
|
|
// Pipe for brew deployment
|
|
|
|
type Pipe struct{}
|
|
|
|
|
2017-01-14 20:41:32 +02:00
|
|
|
// Description of the pipe
|
2017-01-14 19:14:35 +02:00
|
|
|
func (Pipe) Description() string {
|
2017-01-19 11:04:41 +02:00
|
|
|
return "Getting Git info"
|
2017-01-14 16:34:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Run the pipe
|
2017-01-14 18:06:57 +02:00
|
|
|
func (Pipe) Run(ctx *context.Context) (err error) {
|
2017-01-14 16: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-18 19:08:48 +02:00
|
|
|
ctx.Git = context.GitInfo{
|
2017-01-14 18:06:57 +02:00
|
|
|
CurrentTag: tag,
|
|
|
|
PreviousTag: previous,
|
|
|
|
Diff: log,
|
|
|
|
}
|
2017-01-14 16:34:22 +02:00
|
|
|
return
|
|
|
|
}
|