2017-04-14 15:39:32 -03:00
|
|
|
// Package config contains the model and loader of the goreleaser configuration
|
|
|
|
// file.
|
2016-12-21 10:35:34 -02:00
|
|
|
package config
|
|
|
|
|
|
|
|
import (
|
2017-05-10 19:14:17 -07:00
|
|
|
"io"
|
2016-12-21 10:35:34 -02:00
|
|
|
"io/ioutil"
|
2017-05-18 09:02:02 -03:00
|
|
|
"os"
|
2018-05-14 17:22:55 -07:00
|
|
|
"strings"
|
2017-07-08 12:05:57 -03:00
|
|
|
|
2017-06-27 20:06:45 -03:00
|
|
|
"github.com/apex/log"
|
2018-11-06 11:08:25 -02:00
|
|
|
yaml "gopkg.in/yaml.v2"
|
2016-12-21 10:35:34 -02:00
|
|
|
)
|
|
|
|
|
2017-09-26 18:33:22 -03:00
|
|
|
// GitHubURLs holds the URLs to be used when using github enterprise
|
|
|
|
type GitHubURLs struct {
|
2019-01-17 11:25:57 -02:00
|
|
|
API string `yaml:"api,omitempty"`
|
|
|
|
Upload string `yaml:"upload,omitempty"`
|
|
|
|
Download string `yaml:"download,omitempty"`
|
|
|
|
SkipTLSVerify bool `yaml:"skip_tls_verify,omitempty"`
|
2017-09-26 18:33:22 -03:00
|
|
|
}
|
|
|
|
|
2019-06-29 16:02:40 +02:00
|
|
|
// GitLabURLs holds the URLs to be used when using gitlab ce/enterprise
|
|
|
|
type GitLabURLs struct {
|
|
|
|
API string `yaml:"api,omitempty"`
|
|
|
|
Download string `yaml:"download,omitempty"`
|
|
|
|
SkipTLSVerify bool `yaml:"skip_tls_verify,omitempty"`
|
|
|
|
}
|
|
|
|
|
2019-08-26 10:31:38 +03:00
|
|
|
// GiteaURLs holds the URLs to be used when using gitea
|
|
|
|
type GiteaURLs struct {
|
|
|
|
API string `yaml:"api,omitempty"`
|
|
|
|
SkipTLSVerify bool `yaml:"skip_tls_verify,omitempty"`
|
|
|
|
}
|
|
|
|
|
2017-03-22 21:01:29 -03:00
|
|
|
// Repo represents any kind of repo (github, gitlab, etc)
|
|
|
|
type Repo struct {
|
2017-09-26 18:33:22 -03:00
|
|
|
Owner string `yaml:",omitempty"`
|
|
|
|
Name string `yaml:",omitempty"`
|
2017-03-22 21:01:29 -03:00
|
|
|
}
|
|
|
|
|
2017-03-22 21:27:04 -03:00
|
|
|
// String of the repo, e.g. owner/name
|
2017-03-22 21:01:29 -03:00
|
|
|
func (r Repo) String() string {
|
2017-10-15 17:46:21 -02:00
|
|
|
if r.Owner == "" && r.Name == "" {
|
|
|
|
return ""
|
|
|
|
}
|
2017-03-22 21:01:29 -03:00
|
|
|
return r.Owner + "/" + r.Name
|
|
|
|
}
|
|
|
|
|
2017-01-15 14:37:00 -02:00
|
|
|
// Homebrew contains the brew section
|
|
|
|
type Homebrew struct {
|
2018-06-20 09:46:42 -03:00
|
|
|
Name string `yaml:",omitempty"`
|
|
|
|
GitHub Repo `yaml:",omitempty"`
|
2019-08-13 20:28:03 +02:00
|
|
|
GitLab Repo `yaml:",omitempty"`
|
2018-06-20 09:46:42 -03:00
|
|
|
CommitAuthor CommitAuthor `yaml:"commit_author,omitempty"`
|
|
|
|
Folder string `yaml:",omitempty"`
|
|
|
|
Caveats string `yaml:",omitempty"`
|
|
|
|
Plist string `yaml:",omitempty"`
|
|
|
|
Install string `yaml:",omitempty"`
|
|
|
|
Dependencies []string `yaml:",omitempty"`
|
|
|
|
Test string `yaml:",omitempty"`
|
|
|
|
Conflicts []string `yaml:",omitempty"`
|
|
|
|
Description string `yaml:",omitempty"`
|
|
|
|
Homepage string `yaml:",omitempty"`
|
2019-01-30 03:28:05 -08:00
|
|
|
SkipUpload string `yaml:"skip_upload,omitempty"`
|
2018-06-20 09:46:42 -03:00
|
|
|
DownloadStrategy string `yaml:"download_strategy,omitempty"`
|
2018-07-26 16:03:28 +03:00
|
|
|
URLTemplate string `yaml:"url_template,omitempty"`
|
2018-11-21 15:57:44 +00:00
|
|
|
CustomRequire string `yaml:"custom_require,omitempty"`
|
2018-12-30 02:06:54 +00:00
|
|
|
CustomBlock string `yaml:"custom_block,omitempty"`
|
2019-06-10 10:35:19 -03:00
|
|
|
IDs []string `yaml:"ids,omitempty"`
|
2019-09-27 02:46:05 +02:00
|
|
|
Goarm string `yaml:"goarm,omitempty"`
|
2016-12-21 10:35:34 -02:00
|
|
|
}
|
|
|
|
|
2018-02-10 12:38:07 +00:00
|
|
|
// Scoop contains the scoop.sh section
|
|
|
|
type Scoop struct {
|
2018-09-30 11:04:32 -03:00
|
|
|
Name string `yaml:",omitempty"`
|
2018-02-10 12:38:07 +00:00
|
|
|
Bucket Repo `yaml:",omitempty"`
|
|
|
|
CommitAuthor CommitAuthor `yaml:"commit_author,omitempty"`
|
|
|
|
Homepage string `yaml:",omitempty"`
|
|
|
|
Description string `yaml:",omitempty"`
|
|
|
|
License string `yaml:",omitempty"`
|
2018-08-21 04:06:55 +03:00
|
|
|
URLTemplate string `yaml:"url_template,omitempty"`
|
2018-08-25 23:24:42 +03:00
|
|
|
Persist []string `yaml:"persist,omitempty"`
|
2018-02-10 12:38:07 +00:00
|
|
|
}
|
|
|
|
|
2017-09-30 20:37:03 +02:00
|
|
|
// CommitAuthor is the author of a Git commit
|
|
|
|
type CommitAuthor struct {
|
|
|
|
Name string `yaml:",omitempty"`
|
|
|
|
Email string `yaml:",omitempty"`
|
|
|
|
}
|
|
|
|
|
2017-01-21 20:02:51 -02:00
|
|
|
// Hooks define actions to run before and/or after something
|
|
|
|
type Hooks struct {
|
2017-04-28 13:18:32 -03:00
|
|
|
Pre string `yaml:",omitempty"`
|
|
|
|
Post string `yaml:",omitempty"`
|
2017-01-21 20:02:51 -02:00
|
|
|
}
|
|
|
|
|
2017-04-26 20:08:25 -03:00
|
|
|
// IgnoredBuild represents a build ignored by the user
|
|
|
|
type IgnoredBuild struct {
|
|
|
|
Goos, Goarch, Goarm string
|
|
|
|
}
|
|
|
|
|
2018-05-14 17:22:55 -07:00
|
|
|
// StringArray is a wrapper for an array of strings
|
|
|
|
type StringArray []string
|
|
|
|
|
|
|
|
// UnmarshalYAML is a custom unmarshaler that wraps strings in arrays
|
|
|
|
func (a *StringArray) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
|
|
|
var strings []string
|
|
|
|
if err := unmarshal(&strings); err != nil {
|
|
|
|
var str string
|
|
|
|
if err := unmarshal(&str); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
*a = []string{str}
|
|
|
|
} else {
|
|
|
|
*a = strings
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// FlagArray is a wrapper for an array of strings
|
|
|
|
type FlagArray []string
|
|
|
|
|
|
|
|
// UnmarshalYAML is a custom unmarshaler that wraps strings in arrays
|
|
|
|
func (a *FlagArray) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
|
|
|
var flags []string
|
|
|
|
if err := unmarshal(&flags); err != nil {
|
|
|
|
var flagstr string
|
|
|
|
if err := unmarshal(&flagstr); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
*a = strings.Fields(flagstr)
|
|
|
|
} else {
|
|
|
|
*a = flags
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2017-01-15 14:37:00 -02:00
|
|
|
// Build contains the build configuration section
|
|
|
|
type Build struct {
|
2019-04-14 15:16:01 -03:00
|
|
|
ID string `yaml:",omitempty"`
|
2018-04-20 04:26:04 -07:00
|
|
|
Goos []string `yaml:",omitempty"`
|
|
|
|
Goarch []string `yaml:",omitempty"`
|
|
|
|
Goarm []string `yaml:",omitempty"`
|
|
|
|
Targets []string `yaml:",omitempty"`
|
|
|
|
Ignore []IgnoredBuild `yaml:",omitempty"`
|
|
|
|
Main string `yaml:",omitempty"`
|
2018-05-14 17:22:55 -07:00
|
|
|
Ldflags StringArray `yaml:",omitempty"`
|
|
|
|
Flags FlagArray `yaml:",omitempty"`
|
2018-04-20 04:26:04 -07:00
|
|
|
Binary string `yaml:",omitempty"`
|
|
|
|
Hooks Hooks `yaml:",omitempty"`
|
|
|
|
Env []string `yaml:",omitempty"`
|
|
|
|
Lang string `yaml:",omitempty"`
|
2018-05-14 17:22:55 -07:00
|
|
|
Asmflags StringArray `yaml:",omitempty"`
|
|
|
|
Gcflags StringArray `yaml:",omitempty"`
|
2016-12-21 11:37:31 -02:00
|
|
|
}
|
|
|
|
|
2017-04-21 16:01:19 -03:00
|
|
|
// FormatOverride is used to specify a custom format for a specific GOOS.
|
|
|
|
type FormatOverride struct {
|
2017-04-28 13:18:32 -03:00
|
|
|
Goos string `yaml:",omitempty"`
|
|
|
|
Format string `yaml:",omitempty"`
|
2017-04-21 16:01:19 -03:00
|
|
|
}
|
|
|
|
|
2017-01-15 14:37:00 -02:00
|
|
|
// Archive config used for the archive
|
|
|
|
type Archive struct {
|
2019-04-16 10:19:15 -03:00
|
|
|
ID string `yaml:",omitempty"`
|
|
|
|
Builds []string `yaml:",omitempty"`
|
|
|
|
NameTemplate string `yaml:"name_template,omitempty"`
|
|
|
|
Replacements map[string]string `yaml:",omitempty"`
|
|
|
|
Format string `yaml:",omitempty"`
|
|
|
|
FormatOverrides []FormatOverride `yaml:"format_overrides,omitempty"`
|
|
|
|
WrapInDirectory string `yaml:"wrap_in_directory,omitempty"`
|
|
|
|
Files []string `yaml:",omitempty"`
|
2017-01-14 19:47:15 -02:00
|
|
|
}
|
|
|
|
|
2019-06-29 16:02:40 +02:00
|
|
|
// Release config used for the GitHub/GitLab release
|
2017-01-15 14:37:00 -02:00
|
|
|
type Release struct {
|
2017-10-07 04:31:14 -05:00
|
|
|
GitHub Repo `yaml:",omitempty"`
|
2019-06-29 16:02:40 +02:00
|
|
|
GitLab Repo `yaml:",omitempty"`
|
2019-08-26 10:31:38 +03:00
|
|
|
Gitea Repo `yaml:",omitempty"`
|
2017-10-07 04:31:14 -05:00
|
|
|
Draft bool `yaml:",omitempty"`
|
2018-04-24 20:36:05 -07:00
|
|
|
Disable bool `yaml:",omitempty"`
|
2018-11-29 19:42:14 +01:00
|
|
|
Prerelease string `yaml:",omitempty"`
|
2017-10-07 04:31:14 -05:00
|
|
|
NameTemplate string `yaml:"name_template,omitempty"`
|
2017-01-14 14:06:57 -02:00
|
|
|
}
|
|
|
|
|
2018-02-26 18:49:58 -03:00
|
|
|
// NFPM config
|
|
|
|
type NFPM struct {
|
2018-04-21 16:48:22 +02:00
|
|
|
NFPMOverridables `yaml:",inline"`
|
|
|
|
Overrides map[string]NFPMOverridables `yaml:"overrides,omitempty"`
|
|
|
|
|
2019-05-07 07:18:35 -03:00
|
|
|
ID string `yaml:",omitempty"`
|
2019-05-07 06:59:53 -03:00
|
|
|
Builds []string `yaml:",omitempty"`
|
2018-04-21 16:48:22 +02:00
|
|
|
Formats []string `yaml:",omitempty"`
|
|
|
|
Vendor string `yaml:",omitempty"`
|
|
|
|
Homepage string `yaml:",omitempty"`
|
|
|
|
Maintainer string `yaml:",omitempty"`
|
|
|
|
Description string `yaml:",omitempty"`
|
|
|
|
License string `yaml:",omitempty"`
|
|
|
|
Bindir string `yaml:",omitempty"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// NFPMScripts is used to specify maintainer scripts
|
|
|
|
type NFPMScripts struct {
|
|
|
|
PreInstall string `yaml:"preinstall,omitempty"`
|
|
|
|
PostInstall string `yaml:"postinstall,omitempty"`
|
|
|
|
PreRemove string `yaml:"preremove,omitempty"`
|
|
|
|
PostRemove string `yaml:"postremove,omitempty"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// NFPMOverridables is used to specify per package format settings
|
|
|
|
type NFPMOverridables struct {
|
2017-12-26 21:36:17 -02:00
|
|
|
NameTemplate string `yaml:"name_template,omitempty"`
|
2019-06-29 12:26:01 -03:00
|
|
|
Epoch string `yaml:"epoch,omitempty"`
|
2017-12-26 21:36:17 -02:00
|
|
|
Replacements map[string]string `yaml:",omitempty"`
|
2017-08-09 11:54:23 +10:00
|
|
|
Dependencies []string `yaml:",omitempty"`
|
2018-02-18 19:36:52 -03:00
|
|
|
Recommends []string `yaml:",omitempty"`
|
|
|
|
Suggests []string `yaml:",omitempty"`
|
2017-08-09 11:54:23 +10:00
|
|
|
Conflicts []string `yaml:",omitempty"`
|
2018-05-16 21:50:13 -03:00
|
|
|
EmptyFolders []string `yaml:"empty_folders,omitempty"`
|
2017-08-09 11:54:23 +10:00
|
|
|
Files map[string]string `yaml:",omitempty"`
|
2018-02-17 19:30:26 -02:00
|
|
|
ConfigFiles map[string]string `yaml:"config_files,omitempty"`
|
2018-04-18 23:56:15 +02:00
|
|
|
Scripts NFPMScripts `yaml:"scripts,omitempty"`
|
|
|
|
}
|
|
|
|
|
2017-12-13 17:14:01 +01:00
|
|
|
// Sign config
|
|
|
|
type Sign struct {
|
|
|
|
Cmd string `yaml:"cmd,omitempty"`
|
|
|
|
Args []string `yaml:"args,omitempty"`
|
|
|
|
Signature string `yaml:"signature,omitempty"`
|
|
|
|
Artifacts string `yaml:"artifacts,omitempty"`
|
|
|
|
}
|
|
|
|
|
2017-08-04 05:44:49 +00:00
|
|
|
// SnapcraftAppMetadata for the binaries that will be in the snap package
|
2017-08-04 05:42:55 +00:00
|
|
|
type SnapcraftAppMetadata struct {
|
2019-06-23 03:37:55 +02:00
|
|
|
Plugs []string
|
|
|
|
Daemon string
|
|
|
|
Args string
|
|
|
|
Completer string `yaml:",omitempty"`
|
2017-08-04 05:42:55 +00:00
|
|
|
}
|
|
|
|
|
2017-07-27 00:30:48 +00:00
|
|
|
// Snapcraft config
|
|
|
|
type Snapcraft struct {
|
2017-12-27 09:16:00 -02:00
|
|
|
NameTemplate string `yaml:"name_template,omitempty"`
|
|
|
|
Replacements map[string]string `yaml:",omitempty"`
|
2018-10-20 15:13:31 -03:00
|
|
|
Publish bool `yaml:",omitempty"`
|
2017-12-27 09:16:00 -02:00
|
|
|
|
2019-05-29 09:13:52 -03:00
|
|
|
ID string `yaml:",omitempty"`
|
2019-05-27 12:47:05 -03:00
|
|
|
Builds []string `yaml:",omitempty"`
|
2017-12-27 09:16:00 -02:00
|
|
|
Name string `yaml:",omitempty"`
|
|
|
|
Summary string `yaml:",omitempty"`
|
|
|
|
Description string `yaml:",omitempty"`
|
2019-04-18 23:21:40 +03:00
|
|
|
Base string `yaml:",omitempty"`
|
2019-04-17 23:26:30 +03:00
|
|
|
License string `yaml:",omitempty"`
|
2017-12-27 09:16:00 -02:00
|
|
|
Grade string `yaml:",omitempty"`
|
|
|
|
Confinement string `yaml:",omitempty"`
|
|
|
|
Apps map[string]SnapcraftAppMetadata `yaml:",omitempty"`
|
2019-03-14 09:56:11 -03:00
|
|
|
Plugs map[string]interface{} `yaml:",omitempty"`
|
2017-07-27 00:30:48 +00:00
|
|
|
}
|
|
|
|
|
2017-04-29 12:49:22 +02:00
|
|
|
// Snapshot config
|
|
|
|
type Snapshot struct {
|
|
|
|
NameTemplate string `yaml:"name_template,omitempty"`
|
2017-01-29 21:55:32 -02:00
|
|
|
}
|
|
|
|
|
2017-08-27 20:45:33 -03:00
|
|
|
// Checksum config
|
|
|
|
type Checksum struct {
|
|
|
|
NameTemplate string `yaml:"name_template,omitempty"`
|
2019-02-04 17:27:51 -02:00
|
|
|
Algorithm string `yaml:"algorithm,omitempty"`
|
2017-08-27 20:45:33 -03:00
|
|
|
}
|
|
|
|
|
2017-09-11 23:31:00 -03:00
|
|
|
// Docker image config
|
|
|
|
type Docker struct {
|
2019-01-11 16:27:39 -02:00
|
|
|
Binaries []string `yaml:",omitempty"`
|
2018-10-20 20:21:52 +08:00
|
|
|
Goos string `yaml:",omitempty"`
|
|
|
|
Goarch string `yaml:",omitempty"`
|
|
|
|
Goarm string `yaml:",omitempty"`
|
|
|
|
Dockerfile string `yaml:",omitempty"`
|
|
|
|
ImageTemplates []string `yaml:"image_templates,omitempty"`
|
2019-03-06 17:17:53 +01:00
|
|
|
SkipPush string `yaml:"skip_push,omitempty"`
|
2018-10-20 20:21:52 +08:00
|
|
|
Files []string `yaml:"extra_files,omitempty"`
|
|
|
|
BuildFlagTemplates []string `yaml:"build_flag_templates,omitempty"`
|
2017-09-11 23:31:00 -03:00
|
|
|
}
|
|
|
|
|
2017-10-15 20:21:35 -02:00
|
|
|
// Filters config
|
|
|
|
type Filters struct {
|
|
|
|
Exclude []string `yaml:",omitempty"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// Changelog Config
|
|
|
|
type Changelog struct {
|
|
|
|
Filters Filters `yaml:",omitempty"`
|
2017-10-19 20:44:12 -02:00
|
|
|
Sort string `yaml:",omitempty"`
|
2018-12-24 10:42:27 -08:00
|
|
|
Skip bool `yaml:",omitempty"`
|
2017-10-15 20:21:35 -02:00
|
|
|
}
|
|
|
|
|
2018-02-03 16:47:03 -02:00
|
|
|
// EnvFiles holds paths to files that contains environment variables
|
|
|
|
// values like the github token for example
|
2018-02-03 00:06:48 -02:00
|
|
|
type EnvFiles struct {
|
|
|
|
GitHubToken string `yaml:"github_token,omitempty"`
|
2019-06-29 16:02:40 +02:00
|
|
|
GitLabToken string `yaml:"gitlab_token,omitempty"`
|
2019-08-26 10:31:38 +03:00
|
|
|
GiteaToken string `yaml:"gitea_token,omitempty"`
|
2018-02-03 00:06:48 -02:00
|
|
|
}
|
|
|
|
|
2018-03-28 15:31:09 +02:00
|
|
|
// Before config
|
|
|
|
type Before struct {
|
|
|
|
Hooks []string `yaml:",omitempty"`
|
|
|
|
}
|
|
|
|
|
2018-05-13 13:08:14 -03:00
|
|
|
// S3 contains s3 config
|
|
|
|
type S3 struct {
|
2019-07-12 10:10:22 -03:00
|
|
|
Region string `yaml:",omitempty"`
|
|
|
|
Bucket string `yaml:",omitempty"`
|
|
|
|
Folder string `yaml:",omitempty"`
|
|
|
|
Profile string `yaml:",omitempty"`
|
|
|
|
Endpoint string `yaml:",omitempty"` // used for minio for example
|
|
|
|
ACL string `yaml:",omitempty"`
|
2019-06-09 16:51:24 -03:00
|
|
|
IDs []string `yaml:"ids,omitempty"`
|
2018-05-13 13:08:14 -03:00
|
|
|
}
|
|
|
|
|
2019-06-05 15:51:01 +02:00
|
|
|
// Blob contains config for GO CDK blob
|
|
|
|
type Blob struct {
|
2019-07-12 10:10:22 -03:00
|
|
|
Bucket string `yaml:",omitempty"`
|
|
|
|
Provider string `yaml:",omitempty"`
|
|
|
|
Folder string `yaml:",omitempty"`
|
|
|
|
KMSKey string `yaml:",omitempty"`
|
2019-06-09 16:51:24 -03:00
|
|
|
IDs []string `yaml:"ids,omitempty"`
|
2019-06-05 15:51:01 +02:00
|
|
|
}
|
|
|
|
|
2018-06-14 00:37:48 -03:00
|
|
|
// Put HTTP upload configuration
|
|
|
|
type Put struct {
|
2019-05-07 07:18:35 -03:00
|
|
|
Name string `yaml:",omitempty"`
|
|
|
|
IDs []string `yaml:"ids,omitempty"`
|
|
|
|
Target string `yaml:",omitempty"`
|
|
|
|
Username string `yaml:",omitempty"`
|
|
|
|
Mode string `yaml:",omitempty"`
|
|
|
|
ChecksumHeader string `yaml:"checksum_header,omitempty"`
|
|
|
|
TrustedCerts string `yaml:"trusted_certificates,omitempty"`
|
|
|
|
Checksum bool `yaml:",omitempty"`
|
|
|
|
Signature bool `yaml:",omitempty"`
|
2018-05-21 17:37:05 -03:00
|
|
|
}
|
|
|
|
|
2017-01-15 14:37:00 -02:00
|
|
|
// Project includes all project configuration
|
|
|
|
type Project struct {
|
2019-05-27 12:47:05 -03:00
|
|
|
ProjectName string `yaml:"project_name,omitempty"`
|
|
|
|
Env []string `yaml:",omitempty"`
|
|
|
|
Release Release `yaml:",omitempty"`
|
2019-06-10 10:35:19 -03:00
|
|
|
Brew Homebrew `yaml:",omitempty"` // TODO: remove this
|
|
|
|
Brews []Homebrew `yaml:",omitempty"`
|
2019-05-27 12:47:05 -03:00
|
|
|
Scoop Scoop `yaml:",omitempty"`
|
|
|
|
Builds []Build `yaml:",omitempty"`
|
|
|
|
Archive Archive `yaml:",omitempty"` // TODO: remove this
|
|
|
|
Archives []Archive `yaml:",omitempty"`
|
|
|
|
NFPM NFPM `yaml:",omitempty"` // TODO: remove this
|
|
|
|
NFPMs []NFPM `yaml:"nfpms,omitempty"`
|
|
|
|
Snapcraft Snapcraft `yaml:",omitempty"` // TODO: remove this
|
|
|
|
Snapcrafts []Snapcraft `yaml:",omitempty"`
|
|
|
|
Snapshot Snapshot `yaml:",omitempty"`
|
|
|
|
Checksum Checksum `yaml:",omitempty"`
|
|
|
|
Dockers []Docker `yaml:",omitempty"`
|
|
|
|
Artifactories []Put `yaml:",omitempty"`
|
|
|
|
Puts []Put `yaml:",omitempty"`
|
|
|
|
S3 []S3 `yaml:"s3,omitempty"`
|
2019-08-02 16:17:38 -03:00
|
|
|
Blob []Blob `yaml:"blob,omitempty"` // TODO: remove this
|
|
|
|
Blobs []Blob `yaml:"blobs,omitempty"`
|
2019-05-27 12:47:05 -03:00
|
|
|
Changelog Changelog `yaml:",omitempty"`
|
|
|
|
Dist string `yaml:",omitempty"`
|
2019-07-21 18:46:46 -03:00
|
|
|
Sign Sign `yaml:",omitempty"` // TODO: remove this
|
|
|
|
Signs []Sign `yaml:",omitempty"`
|
2019-05-27 12:47:05 -03:00
|
|
|
EnvFiles EnvFiles `yaml:"env_files,omitempty"`
|
|
|
|
Before Before `yaml:",omitempty"`
|
2017-03-25 21:29:38 -03:00
|
|
|
|
2017-07-01 21:27:30 -03:00
|
|
|
// this is a hack ¯\_(ツ)_/¯
|
|
|
|
SingleBuild Build `yaml:"build,omitempty"`
|
|
|
|
|
2017-09-26 18:33:22 -03:00
|
|
|
// should be set if using github enterprise
|
|
|
|
GitHubURLs GitHubURLs `yaml:"github_urls,omitempty"`
|
2019-06-29 16:02:40 +02:00
|
|
|
|
|
|
|
// should be set if using a private gitlab
|
|
|
|
GitLabURLs GitLabURLs `yaml:"gitlab_urls,omitempty"`
|
2019-08-26 10:31:38 +03:00
|
|
|
|
|
|
|
// should be set if using Gitea
|
|
|
|
GiteaURLs GiteaURLs `yaml:"gitea_urls,omitempty"`
|
2016-12-21 10:35:34 -02:00
|
|
|
}
|
|
|
|
|
2016-12-30 12:41:59 -02:00
|
|
|
// Load config file
|
2017-01-15 14:37:00 -02:00
|
|
|
func Load(file string) (config Project, err error) {
|
2018-09-04 09:26:45 -03:00
|
|
|
f, err := os.Open(file) // #nosec
|
2016-12-21 10:35:34 -02:00
|
|
|
if err != nil {
|
2017-05-18 09:02:02 -03:00
|
|
|
return
|
2016-12-21 10:35:34 -02:00
|
|
|
}
|
2019-08-02 18:20:59 -03:00
|
|
|
defer f.Close()
|
2017-07-04 23:51:45 -03:00
|
|
|
log.WithField("file", file).Info("loading config file")
|
2017-05-18 09:02:02 -03:00
|
|
|
return LoadReader(f)
|
2016-12-31 10:53:48 +00:00
|
|
|
}
|
2017-05-10 19:14:17 -07:00
|
|
|
|
2017-05-18 09:02:02 -03:00
|
|
|
// LoadReader config via io.Reader
|
2017-05-10 19:14:17 -07:00
|
|
|
func LoadReader(fd io.Reader) (config Project, err error) {
|
|
|
|
data, err := ioutil.ReadAll(fd)
|
|
|
|
if err != nil {
|
2017-05-10 19:35:44 -07:00
|
|
|
return config, err
|
|
|
|
}
|
2018-01-26 14:38:16 -02:00
|
|
|
err = yaml.UnmarshalStrict(data, &config)
|
2017-07-01 21:27:30 -03:00
|
|
|
log.WithField("config", config).Debug("loaded config file")
|
2018-01-26 14:38:16 -02:00
|
|
|
return config, err
|
2017-07-08 12:05:57 -03:00
|
|
|
}
|