1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-24 04:16:27 +02:00
goreleaser/main.go

65 lines
1.5 KiB
Go
Raw Normal View History

2016-12-21 10:35:34 -02:00
package main
import (
2016-12-21 15:03:07 -02:00
"log"
2016-12-31 14:07:58 -02:00
"os"
2016-12-21 10:35:34 -02:00
"github.com/goreleaser/releaser/config"
2017-01-14 12:34:22 -02:00
"github.com/goreleaser/releaser/context"
2016-12-30 09:27:35 -02:00
"github.com/goreleaser/releaser/pipeline"
"github.com/goreleaser/releaser/pipeline/brew"
"github.com/goreleaser/releaser/pipeline/build"
"github.com/goreleaser/releaser/pipeline/compress"
2017-01-14 12:34:22 -02:00
"github.com/goreleaser/releaser/pipeline/defaults"
"github.com/goreleaser/releaser/pipeline/git"
2016-12-30 09:27:35 -02:00
"github.com/goreleaser/releaser/pipeline/release"
2017-01-14 12:34:22 -02:00
"github.com/goreleaser/releaser/pipeline/repos"
"github.com/goreleaser/releaser/pipeline/valid"
2016-12-31 13:57:39 -02:00
"github.com/urfave/cli"
2016-12-21 10:35:34 -02:00
)
2016-12-29 18:10:11 -02:00
var version = "master"
2016-12-21 14:42:23 -02:00
2016-12-31 13:57:39 -02:00
var pipes = []pipeline.Pipe{
2017-01-14 12:34:22 -02:00
defaults.Pipe{},
valid.Pipe{},
git.Pipe{},
2016-12-31 13:57:39 -02:00
build.Pipe{},
compress.Pipe{},
2017-01-14 12:34:22 -02:00
repos.Pipe{},
2016-12-31 13:57:39 -02:00
release.Pipe{},
brew.Pipe{},
}
2016-12-21 10:35:34 -02:00
func main() {
2016-12-31 13:57:39 -02:00
var app = cli.NewApp()
app.Name = "release"
app.Version = version
app.Usage = "Deliver Go binaries as fast and easily as possible"
app.Flags = []cli.Flag{
cli.StringFlag{
Name: "config, c",
Usage: "Load configuration from `FILE`",
Value: "goreleaser.yml",
},
2016-12-28 22:23:39 -02:00
}
2016-12-31 13:57:39 -02:00
app.Action = func(c *cli.Context) (err error) {
var file = c.String("config")
config, err := config.Load(file)
if err != nil {
return cli.NewExitError(err.Error(), 1)
}
2017-01-14 12:34:22 -02:00
context := context.New(config)
2016-12-31 13:57:39 -02:00
for _, pipe := range pipes {
2017-01-14 12:34:22 -02:00
if err := pipe.Run(context); err != nil {
2016-12-31 13:57:39 -02:00
return cli.NewExitError(pipe.Name()+" failed: "+err.Error(), 1)
}
2016-12-29 09:58:22 -02:00
}
2016-12-31 13:57:39 -02:00
log.Println("Done!")
return
2016-12-21 15:03:07 -02:00
}
2017-01-02 13:20:33 -02:00
if err := app.Run(os.Args); err != nil {
log.Fatalln(err)
}
2016-12-21 10:35:34 -02:00
}