2017-01-14 14:06:57 -02:00
|
|
|
package env
|
|
|
|
|
|
|
|
import (
|
|
|
|
"errors"
|
|
|
|
"os"
|
|
|
|
|
2017-01-14 20:01:32 -02:00
|
|
|
"github.com/goreleaser/goreleaser/context"
|
2017-01-14 14:06:57 -02:00
|
|
|
)
|
|
|
|
|
2017-01-14 19:41:32 +01:00
|
|
|
// ErrMissingToken indicates an error when GITHUB_TOKEN is missing in the environment
|
2017-01-14 14:06:57 -02:00
|
|
|
var ErrMissingToken = errors.New("Missing GITHUB_TOKEN")
|
|
|
|
|
|
|
|
// Pipe for env
|
|
|
|
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 "Loading environment variables"
|
2017-01-14 14:06:57 -02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Run the pipe
|
|
|
|
func (Pipe) Run(ctx *context.Context) (err error) {
|
2017-01-18 15:08:48 -02:00
|
|
|
ctx.Token = os.Getenv("GITHUB_TOKEN")
|
|
|
|
if ctx.Token == "" {
|
2017-01-14 14:06:57 -02:00
|
|
|
return ErrMissingToken
|
|
|
|
}
|
|
|
|
return
|
|
|
|
}
|