1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-10 03:47:03 +02:00
goreleaser/config/config.go

43 lines
769 B
Go
Raw Normal View History

2016-12-21 14:35:34 +02:00
package config
import (
"io/ioutil"
yaml "gopkg.in/yaml.v1"
)
2016-12-30 16:41:59 +02:00
// Homebrew contains the brew section
type Homebrew struct {
2016-12-29 17:14:52 +02:00
Repo string
2017-01-14 15:18:48 +02:00
Folder string
2016-12-29 17:14:52 +02:00
Caveats string
2016-12-21 14:35:34 +02:00
}
2016-12-30 16:41:59 +02:00
// BuildConfig contains the build configuration section
2016-12-21 15:37:31 +02:00
type BuildConfig struct {
2017-01-12 00:25:52 +02:00
Oses []string
Arches []string
Main string
Ldflags string
2016-12-21 15:37:31 +02:00
}
2016-12-30 16:41:59 +02:00
// ProjectConfig includes all project configuration
2016-12-21 14:35:34 +02:00
type ProjectConfig struct {
2017-01-11 18:47:56 +02:00
Repo string
BinaryName string `yaml:"binary_name"`
Files []string
Brew Homebrew
Build BuildConfig
Archive ArchiveConfig
2016-12-21 14:35:34 +02:00
}
2016-12-30 16:41:59 +02:00
// Load config file
2016-12-21 14:35:34 +02:00
func Load(file string) (config ProjectConfig, err error) {
data, err := ioutil.ReadFile(file)
if err != nil {
return config, err
}
2017-01-14 16:34:22 +02:00
err = yaml.Unmarshal(data, &config)
return
}