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
|
|
|
|
2017-01-14 20:01:32 -02:00
|
|
|
"github.com/goreleaser/goreleaser/config"
|
|
|
|
"github.com/goreleaser/goreleaser/context"
|
|
|
|
"github.com/goreleaser/goreleaser/pipeline"
|
2017-01-14 20:13:49 -02:00
|
|
|
"github.com/goreleaser/goreleaser/pipeline/archive"
|
2017-01-14 20: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 09:47:17 +01:00
|
|
|
"github.com/goreleaser/goreleaser/pipeline/source"
|
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 14:06:57 -02:00
|
|
|
// load data, set defaults, etc...
|
2017-01-14 12:34:22 -02:00
|
|
|
defaults.Pipe{},
|
2017-01-14 14:06:57 -02:00
|
|
|
env.Pipe{},
|
2017-01-14 12:34:22 -02:00
|
|
|
git.Pipe{},
|
2017-01-14 14:06:57 -02:00
|
|
|
repos.Pipe{},
|
|
|
|
|
2017-01-19 09:47:17 +01:00
|
|
|
&source.Pipe{},
|
|
|
|
|
2017-01-14 14:06:57 -02:00
|
|
|
// real work
|
2016-12-31 13:57:39 -02:00
|
|
|
build.Pipe{},
|
2017-01-14 19:47:15 -02:00
|
|
|
archive.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()
|
2017-01-18 15:45:42 -02:00
|
|
|
app.Name = "goreleaser"
|
2016-12-31 13: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-28 22:23:39 -02:00
|
|
|
}
|
2017-01-21 19:11:54 -02:00
|
|
|
app.Action = func(c *cli.Context) (err error) {
|
2016-12-31 13:57:39 -02:00
|
|
|
var file = c.String("config")
|
2017-01-14 19:29:57 +01: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 13:57:39 -02:00
|
|
|
return cli.NewExitError(err.Error(), 1)
|
|
|
|
}
|
2017-01-19 09:47:17 +01:00
|
|
|
ctx := context.New(cfg)
|
2017-01-14 14:06:57 -02:00
|
|
|
log.SetFlags(0)
|
2017-01-21 19: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 09:58:22 -02:00
|
|
|
}
|
2016-12-31 13:57:39 -02:00
|
|
|
log.Println("Done!")
|
2017-01-21 19:11:54 -02:00
|
|
|
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
|
|
|
}
|