2016-12-21 14:35:34 +02:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2016-12-21 19:03:07 +02:00
|
|
|
"log"
|
2016-12-31 18:07:58 +02:00
|
|
|
"os"
|
2016-12-21 14:35:34 +02:00
|
|
|
|
2017-01-15 00:01:32 +02:00
|
|
|
"github.com/goreleaser/goreleaser/config"
|
|
|
|
"github.com/goreleaser/goreleaser/context"
|
|
|
|
"github.com/goreleaser/goreleaser/pipeline"
|
2017-01-15 00:13:49 +02:00
|
|
|
"github.com/goreleaser/goreleaser/pipeline/archive"
|
2017-01-15 00:01:32 +02:00
|
|
|
"github.com/goreleaser/goreleaser/pipeline/brew"
|
|
|
|
"github.com/goreleaser/goreleaser/pipeline/build"
|
|
|
|
"github.com/goreleaser/goreleaser/pipeline/defaults"
|
|
|
|
"github.com/goreleaser/goreleaser/pipeline/env"
|
|
|
|
"github.com/goreleaser/goreleaser/pipeline/git"
|
|
|
|
"github.com/goreleaser/goreleaser/pipeline/release"
|
|
|
|
"github.com/goreleaser/goreleaser/pipeline/repos"
|
2017-01-19 10:47:17 +02:00
|
|
|
"github.com/goreleaser/goreleaser/pipeline/source"
|
2016-12-31 17:57:39 +02:00
|
|
|
"github.com/urfave/cli"
|
2016-12-21 14:35:34 +02:00
|
|
|
)
|
|
|
|
|
2016-12-29 22:10:11 +02:00
|
|
|
var version = "master"
|
2016-12-21 18:42:23 +02:00
|
|
|
|
2016-12-31 17:57:39 +02:00
|
|
|
var pipes = []pipeline.Pipe{
|
2017-01-14 18:06:57 +02:00
|
|
|
// load data, set defaults, etc...
|
2017-01-14 16:34:22 +02:00
|
|
|
defaults.Pipe{},
|
2017-01-14 18:06:57 +02:00
|
|
|
env.Pipe{},
|
2017-01-14 16:34:22 +02:00
|
|
|
git.Pipe{},
|
2017-01-14 18:06:57 +02:00
|
|
|
repos.Pipe{},
|
|
|
|
|
2017-01-19 10:47:17 +02:00
|
|
|
&source.Pipe{},
|
|
|
|
|
2017-01-14 18:06:57 +02:00
|
|
|
// real work
|
2016-12-31 17:57:39 +02:00
|
|
|
build.Pipe{},
|
2017-01-14 23:47:15 +02:00
|
|
|
archive.Pipe{},
|
2016-12-31 17:57:39 +02:00
|
|
|
release.Pipe{},
|
|
|
|
brew.Pipe{},
|
|
|
|
}
|
|
|
|
|
2016-12-21 14:35:34 +02:00
|
|
|
func main() {
|
2016-12-31 17:57:39 +02:00
|
|
|
var app = cli.NewApp()
|
2017-01-18 19:45:42 +02:00
|
|
|
app.Name = "goreleaser"
|
2016-12-31 17:57:39 +02:00
|
|
|
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-29 02:23:39 +02:00
|
|
|
}
|
2017-01-21 23:11:54 +02:00
|
|
|
app.Action = func(c *cli.Context) (err error) {
|
2016-12-31 17:57:39 +02:00
|
|
|
var file = c.String("config")
|
2017-01-14 20:29:57 +02:00
|
|
|
cfg, err := config.Load(file)
|
|
|
|
// Allow failing to load the config file if file is not explicitly specified
|
|
|
|
if err != nil && c.IsSet("config") {
|
2016-12-31 17:57:39 +02:00
|
|
|
return cli.NewExitError(err.Error(), 1)
|
|
|
|
}
|
2017-01-19 10:47:17 +02:00
|
|
|
ctx := context.New(cfg)
|
2017-01-14 18:06:57 +02:00
|
|
|
log.SetFlags(0)
|
2017-01-21 23:11:54 +02:00
|
|
|
for _, pipe := range pipes {
|
|
|
|
log.Println(pipe.Description())
|
|
|
|
log.SetPrefix(" -> ")
|
|
|
|
if err := pipe.Run(ctx); err != nil {
|
|
|
|
return cli.NewExitError(err.Error(), 1)
|
|
|
|
}
|
|
|
|
log.SetPrefix("")
|
2016-12-29 13:58:22 +02:00
|
|
|
}
|
2016-12-31 17:57:39 +02:00
|
|
|
log.Println("Done!")
|
2017-01-21 23:11:54 +02:00
|
|
|
return
|
2016-12-21 19:03:07 +02:00
|
|
|
}
|
2017-01-02 17:20:33 +02:00
|
|
|
if err := app.Run(os.Args); err != nil {
|
|
|
|
log.Fatalln(err)
|
|
|
|
}
|
2016-12-21 14:35:34 +02:00
|
|
|
}
|