github.com/goreleaser/goreleaser@v1.25.1/pkg/config/config.go (about)

     1  // Package config contains the model and loader of the goreleaser configuration
     2  // file.
     3  package config
     4  
     5  import (
     6  	"encoding/json"
     7  	"fmt"
     8  	"io/fs"
     9  	"os"
    10  	"strings"
    11  	"time"
    12  
    13  	"github.com/goreleaser/nfpm/v2/files"
    14  	"github.com/invopop/jsonschema"
    15  )
    16  
    17  type Versioned struct {
    18  	Version int
    19  }
    20  
    21  // Git configs.
    22  type Git struct {
    23  	TagSort          string   `yaml:"tag_sort,omitempty" json:"tag_sort,omitempty" jsonschema:"enum=-version:refname,enum=-version:creatordate,default=-version:refname"`
    24  	PrereleaseSuffix string   `yaml:"prerelease_suffix,omitempty" json:"prerelease_suffix,omitempty"`
    25  	IgnoreTags       []string `yaml:"ignore_tags,omitempty" json:"ignore_tags,omitempty"`
    26  }
    27  
    28  // GitHubURLs holds the URLs to be used when using github enterprise.
    29  type GitHubURLs struct {
    30  	API           string `yaml:"api,omitempty" json:"api,omitempty"`
    31  	Upload        string `yaml:"upload,omitempty" json:"upload,omitempty"`
    32  	Download      string `yaml:"download,omitempty" json:"download,omitempty"`
    33  	SkipTLSVerify bool   `yaml:"skip_tls_verify,omitempty" json:"skip_tls_verify,omitempty"`
    34  }
    35  
    36  // GitLabURLs holds the URLs to be used when using gitlab ce/enterprise.
    37  type GitLabURLs struct {
    38  	API                string `yaml:"api,omitempty" json:"api,omitempty"`
    39  	Download           string `yaml:"download,omitempty" json:"download,omitempty"`
    40  	SkipTLSVerify      bool   `yaml:"skip_tls_verify,omitempty" json:"skip_tls_verify,omitempty"`
    41  	UsePackageRegistry bool   `yaml:"use_package_registry,omitempty" json:"use_package_registry,omitempty"`
    42  	UseJobToken        bool   `yaml:"use_job_token,omitempty" json:"use_job_token,omitempty"`
    43  }
    44  
    45  // GiteaURLs holds the URLs to be used when using gitea.
    46  type GiteaURLs struct {
    47  	API           string `yaml:"api,omitempty" json:"api,omitempty"`
    48  	Download      string `yaml:"download,omitempty" json:"download,omitempty"`
    49  	SkipTLSVerify bool   `yaml:"skip_tls_verify,omitempty" json:"skip_tls_verify,omitempty"`
    50  }
    51  
    52  // Repo represents any kind of repo (github, gitlab, etc).
    53  // to upload releases into.
    54  type Repo struct {
    55  	Owner  string `yaml:"owner,omitempty" json:"owner,omitempty"`
    56  	Name   string `yaml:"name,omitempty" json:"name,omitempty"`
    57  	RawURL string `yaml:"-" json:"-"`
    58  }
    59  
    60  // String of the repo, e.g. owner/name.
    61  func (r Repo) String() string {
    62  	if r.isSCM() {
    63  		return r.Owner + "/" + r.Name
    64  	}
    65  	return r.Owner
    66  }
    67  
    68  // CheckSCM returns an error if the given url is not a valid scm url.
    69  func (r Repo) CheckSCM() error {
    70  	if r.isSCM() {
    71  		return nil
    72  	}
    73  	return fmt.Errorf("invalid scm url: %s", r.RawURL)
    74  }
    75  
    76  // isSCM returns true if the repo has both an owner and name.
    77  func (r Repo) isSCM() bool {
    78  	return r.Owner != "" && r.Name != ""
    79  }
    80  
    81  // RepoRef represents any kind of repo which may differ
    82  // from the one we are building from and may therefore
    83  // also require separate authentication
    84  // e.g. Homebrew Tap, Scoop bucket.
    85  type RepoRef struct {
    86  	Owner  string `yaml:"owner,omitempty" json:"owner,omitempty"`
    87  	Name   string `yaml:"name,omitempty" json:"name,omitempty"`
    88  	Token  string `yaml:"token,omitempty" json:"token,omitempty"`
    89  	Branch string `yaml:"branch,omitempty" json:"branch,omitempty"`
    90  
    91  	Git         GitRepoRef  `yaml:"git,omitempty" json:"git,omitempty"`
    92  	PullRequest PullRequest `yaml:"pull_request,omitempty" json:"pull_request,omitempty"`
    93  }
    94  
    95  type GitRepoRef struct {
    96  	URL        string `yaml:"url,omitempty" json:"url,omitempty"`
    97  	SSHCommand string `yaml:"ssh_command,omitempty" json:"ssh_command,omitempty"`
    98  	PrivateKey string `yaml:"private_key,omitempty" json:"private_key,omitempty"`
    99  }
   100  
   101  type PullRequestBase struct {
   102  	Owner  string `yaml:"owner,omitempty" json:"owner,omitempty"`
   103  	Name   string `yaml:"name,omitempty" json:"name,omitempty"`
   104  	Branch string `yaml:"branch,omitempty" json:"branch,omitempty"`
   105  }
   106  
   107  // type alias to prevent stack overflowing in the custom unmarshaler.
   108  type pullRequestBase PullRequestBase
   109  
   110  // UnmarshalYAML is a custom unmarshaler that accept brew deps in both the old and new format.
   111  func (a *PullRequestBase) UnmarshalYAML(unmarshal func(interface{}) error) error {
   112  	var str string
   113  	if err := unmarshal(&str); err == nil {
   114  		a.Branch = str
   115  		return nil
   116  	}
   117  
   118  	var base pullRequestBase
   119  	if err := unmarshal(&base); err != nil {
   120  		return err
   121  	}
   122  
   123  	a.Branch = base.Branch
   124  	a.Owner = base.Owner
   125  	a.Name = base.Name
   126  
   127  	return nil
   128  }
   129  
   130  func (a PullRequestBase) JSONSchema() *jsonschema.Schema {
   131  	reflector := jsonschema.Reflector{
   132  		ExpandedStruct: true,
   133  	}
   134  	schema := reflector.Reflect(&pullRequestBase{})
   135  	return &jsonschema.Schema{
   136  		OneOf: []*jsonschema.Schema{
   137  			{
   138  				Type: "string",
   139  			},
   140  			schema,
   141  		},
   142  	}
   143  }
   144  
   145  type PullRequest struct {
   146  	Enabled bool            `yaml:"enabled,omitempty" json:"enabled,omitempty"`
   147  	Base    PullRequestBase `yaml:"base,omitempty" json:"base,omitempty"`
   148  	Draft   bool            `yaml:"draft,omitempty" json:"draft,omitempty"`
   149  }
   150  
   151  // HomebrewDependency represents Homebrew dependency.
   152  type HomebrewDependency struct {
   153  	Name    string `yaml:"name,omitempty" json:"name,omitempty"`
   154  	Type    string `yaml:"type,omitempty" json:"type,omitempty"`
   155  	Version string `yaml:"version,omitempty" json:"version,omitempty"`
   156  	OS      string `yaml:"os,omitempty" json:"os,omitempty" jsonschema:"enum=mac,enum=linux"`
   157  }
   158  
   159  // type alias to prevent stack overflowing in the custom unmarshaler.
   160  type homebrewDependency HomebrewDependency
   161  
   162  // UnmarshalYAML is a custom unmarshaler that accept brew deps in both the old and new format.
   163  func (a *HomebrewDependency) UnmarshalYAML(unmarshal func(interface{}) error) error {
   164  	var str string
   165  	if err := unmarshal(&str); err == nil {
   166  		a.Name = str
   167  		return nil
   168  	}
   169  
   170  	var dep homebrewDependency
   171  	if err := unmarshal(&dep); err != nil {
   172  		return err
   173  	}
   174  
   175  	a.Name = dep.Name
   176  	a.Type = dep.Type
   177  
   178  	return nil
   179  }
   180  
   181  func (a HomebrewDependency) JSONSchema() *jsonschema.Schema {
   182  	reflector := jsonschema.Reflector{
   183  		ExpandedStruct: true,
   184  	}
   185  	schema := reflector.Reflect(&homebrewDependency{})
   186  	return &jsonschema.Schema{
   187  		OneOf: []*jsonschema.Schema{
   188  			{
   189  				Type: "string",
   190  			},
   191  			schema,
   192  		},
   193  	}
   194  }
   195  
   196  type AUR struct {
   197  	Name                  string       `yaml:"name,omitempty" json:"name,omitempty"`
   198  	IDs                   []string     `yaml:"ids,omitempty" json:"ids,omitempty"`
   199  	CommitAuthor          CommitAuthor `yaml:"commit_author,omitempty" json:"commit_author,omitempty"`
   200  	CommitMessageTemplate string       `yaml:"commit_msg_template,omitempty" json:"commit_msg_template,omitempty"`
   201  	Description           string       `yaml:"description,omitempty" json:"description,omitempty"`
   202  	Homepage              string       `yaml:"homepage,omitempty" json:"homepage,omitempty"`
   203  	License               string       `yaml:"license,omitempty" json:"license,omitempty"`
   204  	SkipUpload            string       `yaml:"skip_upload,omitempty" json:"skip_upload,omitempty" jsonschema:"oneof_type=string;boolean"`
   205  	URLTemplate           string       `yaml:"url_template,omitempty" json:"url_template,omitempty"`
   206  	Maintainers           []string     `yaml:"maintainers,omitempty" json:"maintainers,omitempty"`
   207  	Contributors          []string     `yaml:"contributors,omitempty" json:"contributors,omitempty"`
   208  	Provides              []string     `yaml:"provides,omitempty" json:"provides,omitempty"`
   209  	Conflicts             []string     `yaml:"conflicts,omitempty" json:"conflicts,omitempty"`
   210  	Depends               []string     `yaml:"depends,omitempty" json:"depends,omitempty"`
   211  	OptDepends            []string     `yaml:"optdepends,omitempty" json:"optdepends,omitempty"`
   212  	Backup                []string     `yaml:"backup,omitempty" json:"backup,omitempty"`
   213  	Rel                   string       `yaml:"rel,omitempty" json:"rel,omitempty"`
   214  	Package               string       `yaml:"package,omitempty" json:"package,omitempty"`
   215  	GitURL                string       `yaml:"git_url,omitempty" json:"git_url,omitempty"`
   216  	GitSSHCommand         string       `yaml:"git_ssh_command,omitempty" json:"git_ssh_command,omitempty"`
   217  	PrivateKey            string       `yaml:"private_key,omitempty" json:"private_key,omitempty"`
   218  	Goamd64               string       `yaml:"goamd64,omitempty" json:"goamd64,omitempty"`
   219  	Directory             string       `yaml:"directory,omitempty" json:"directory,omitempty"`
   220  }
   221  
   222  // Homebrew contains the brew section.
   223  type Homebrew struct {
   224  	Name                  string               `yaml:"name,omitempty" json:"name,omitempty"`
   225  	Repository            RepoRef              `yaml:"repository,omitempty" json:"repository,omitempty"`
   226  	CommitAuthor          CommitAuthor         `yaml:"commit_author,omitempty" json:"commit_author,omitempty"`
   227  	CommitMessageTemplate string               `yaml:"commit_msg_template,omitempty" json:"commit_msg_template,omitempty"`
   228  	Directory             string               `yaml:"directory,omitempty" json:"directory,omitempty"`
   229  	Caveats               string               `yaml:"caveats,omitempty" json:"caveats,omitempty"`
   230  	Install               string               `yaml:"install,omitempty" json:"install,omitempty"`
   231  	ExtraInstall          string               `yaml:"extra_install,omitempty" json:"extra_install,omitempty"`
   232  	PostInstall           string               `yaml:"post_install,omitempty" json:"post_install,omitempty"`
   233  	Dependencies          []HomebrewDependency `yaml:"dependencies,omitempty" json:"dependencies,omitempty"`
   234  	Test                  string               `yaml:"test,omitempty" json:"test,omitempty"`
   235  	Conflicts             []string             `yaml:"conflicts,omitempty" json:"conflicts,omitempty"`
   236  	Description           string               `yaml:"description,omitempty" json:"description,omitempty"`
   237  	Homepage              string               `yaml:"homepage,omitempty" json:"homepage,omitempty"`
   238  	License               string               `yaml:"license,omitempty" json:"license,omitempty"`
   239  	SkipUpload            string               `yaml:"skip_upload,omitempty" json:"skip_upload,omitempty" jsonschema:"oneof_type=string;boolean"`
   240  	DownloadStrategy      string               `yaml:"download_strategy,omitempty" json:"download_strategy,omitempty"`
   241  	URLTemplate           string               `yaml:"url_template,omitempty" json:"url_template,omitempty"`
   242  	URLHeaders            []string             `yaml:"url_headers,omitempty" json:"url_headers,omitempty"`
   243  	CustomRequire         string               `yaml:"custom_require,omitempty" json:"custom_require,omitempty"`
   244  	CustomBlock           string               `yaml:"custom_block,omitempty" json:"custom_block,omitempty"`
   245  	IDs                   []string             `yaml:"ids,omitempty" json:"ids,omitempty"`
   246  	Goarm                 string               `yaml:"goarm,omitempty" json:"goarm,omitempty" jsonschema:"oneof_type=string;integer"`
   247  	Goamd64               string               `yaml:"goamd64,omitempty" json:"goamd64,omitempty"`
   248  	Service               string               `yaml:"service,omitempty" json:"service,omitempty"`
   249  
   250  	// Deprecated: use Repository instead.
   251  	Tap RepoRef `yaml:"tap,omitempty" json:"tap,omitempty" jsonschema:"deprecated=true,description=use repository instead"`
   252  
   253  	// Deprecated: use Service instead.
   254  	Plist string `yaml:"plist,omitempty" json:"plist,omitempty" jsonschema:"deprecated=true,description=use service instead"`
   255  
   256  	// Deprecated: use Directory instead.
   257  	Folder string `yaml:"folder,omitempty" json:"folder,omitempty" jsonschema:"deprecated=true"`
   258  }
   259  
   260  type Nix struct {
   261  	Name                  string       `yaml:"name,omitempty" json:"name,omitempty"`
   262  	Path                  string       `yaml:"path,omitempty" json:"path,omitempty"`
   263  	Repository            RepoRef      `yaml:"repository,omitempty" json:"repository,omitempty"`
   264  	CommitAuthor          CommitAuthor `yaml:"commit_author,omitempty" json:"commit_author,omitempty"`
   265  	CommitMessageTemplate string       `yaml:"commit_msg_template,omitempty" json:"commit_msg_template,omitempty"`
   266  	IDs                   []string     `yaml:"ids,omitempty" json:"ids,omitempty"`
   267  	Goamd64               string       `yaml:"goamd64,omitempty" json:"goamd64,omitempty"`
   268  	SkipUpload            string       `yaml:"skip_upload,omitempty" json:"skip_upload,omitempty" jsonschema:"oneof_type=string;boolean"`
   269  	URLTemplate           string       `yaml:"url_template,omitempty" json:"url_template,omitempty"`
   270  	Install               string       `yaml:"install,omitempty" json:"install,omitempty"`
   271  	ExtraInstall          string       `yaml:"extra_install,omitempty" json:"extra_install,omitempty"`
   272  	PostInstall           string       `yaml:"post_install,omitempty" json:"post_install,omitempty"`
   273  	Description           string       `yaml:"description,omitempty" json:"description,omitempty"`
   274  	Homepage              string       `yaml:"homepage,omitempty" json:"homepage,omitempty"`
   275  	License               string       `yaml:"license,omitempty" json:"license,omitempty"`
   276  
   277  	Dependencies []NixDependency `yaml:"dependencies,omitempty" json:"dependencies,omitempty"`
   278  }
   279  
   280  type NixDependency struct {
   281  	Name string `yaml:"name" json:"name"`
   282  	OS   string `yaml:"os,omitempty" json:"os,omitempty" jsonschema:"enum=linux,enum=darwin"`
   283  }
   284  
   285  func (a NixDependency) JSONSchema() *jsonschema.Schema {
   286  	reflector := jsonschema.Reflector{
   287  		ExpandedStruct: true,
   288  	}
   289  	type nixDependencyAlias NixDependency
   290  	schema := reflector.Reflect(&nixDependencyAlias{})
   291  	return &jsonschema.Schema{
   292  		OneOf: []*jsonschema.Schema{
   293  			{
   294  				Type: "string",
   295  			},
   296  			schema,
   297  		},
   298  	}
   299  }
   300  
   301  func (a *NixDependency) UnmarshalYAML(unmarshal func(interface{}) error) error {
   302  	var str string
   303  	if err := unmarshal(&str); err == nil {
   304  		a.Name = str
   305  		return nil
   306  	}
   307  
   308  	type t NixDependency
   309  	var dep t
   310  	if err := unmarshal(&dep); err != nil {
   311  		return err
   312  	}
   313  
   314  	a.Name = dep.Name
   315  	a.OS = dep.OS
   316  
   317  	return nil
   318  }
   319  
   320  type Winget struct {
   321  	Name                  string             `yaml:"name,omitempty" json:"name,omitempty"`
   322  	PackageIdentifier     string             `yaml:"package_identifier,omitempty" json:"package_identifier,omitempty"`
   323  	Publisher             string             `yaml:"publisher" json:"publisher"`
   324  	PublisherURL          string             `yaml:"publisher_url,omitempty" json:"publisher_url,omitempty"`
   325  	PublisherSupportURL   string             `yaml:"publisher_support_url,omitempty" json:"publisher_support_url,omitempty"`
   326  	Copyright             string             `yaml:"copyright,omitempty" json:"copyright,omitempty"`
   327  	CopyrightURL          string             `yaml:"copyright_url,omitempty" json:"copyright_url,omitempty"`
   328  	Author                string             `yaml:"author,omitempty" json:"author,omitempty"`
   329  	Path                  string             `yaml:"path,omitempty" json:"path,omitempty"`
   330  	Repository            RepoRef            `yaml:"repository" json:"repository"`
   331  	CommitAuthor          CommitAuthor       `yaml:"commit_author,omitempty" json:"commit_author,omitempty"`
   332  	CommitMessageTemplate string             `yaml:"commit_msg_template,omitempty" json:"commit_msg_template,omitempty"`
   333  	IDs                   []string           `yaml:"ids,omitempty" json:"ids,omitempty"`
   334  	Goamd64               string             `yaml:"goamd64,omitempty" json:"goamd64,omitempty"`
   335  	SkipUpload            string             `yaml:"skip_upload,omitempty" json:"skip_upload,omitempty" jsonschema:"oneof_type=string;boolean"`
   336  	URLTemplate           string             `yaml:"url_template,omitempty" json:"url_template,omitempty"`
   337  	ShortDescription      string             `yaml:"short_description" json:"short_description"`
   338  	Description           string             `yaml:"description,omitempty" json:"description,omitempty"`
   339  	Homepage              string             `yaml:"homepage,omitempty" json:"homepage,omitempty"`
   340  	License               string             `yaml:"license" json:"license"`
   341  	LicenseURL            string             `yaml:"license_url,omitempty" json:"license_url,omitempty"`
   342  	ReleaseNotes          string             `yaml:"release_notes,omitempty" json:"release_notes,omitempty"`
   343  	ReleaseNotesURL       string             `yaml:"release_notes_url,omitempty" json:"release_notes_url,omitempty"`
   344  	Tags                  []string           `yaml:"tags,omitempty" json:"tags,omitempty"`
   345  	Dependencies          []WingetDependency `yaml:"dependencies,omitempty" json:"dependencies,omitempty"`
   346  }
   347  
   348  type WingetDependency struct {
   349  	PackageIdentifier string `yaml:"package_identifier" json:"package_identifier"`
   350  	MinimumVersion    string `yaml:"minimum_version,omitempty" json:"minimum_version,omitempty"`
   351  }
   352  
   353  // Krew contains the krew section.
   354  type Krew struct {
   355  	IDs                   []string     `yaml:"ids,omitempty" json:"ids,omitempty"`
   356  	Name                  string       `yaml:"name,omitempty" json:"name,omitempty"`
   357  	Repository            RepoRef      `yaml:"repository,omitempty" json:"repository,omitempty"`
   358  	CommitAuthor          CommitAuthor `yaml:"commit_author,omitempty" json:"commit_author,omitempty"`
   359  	CommitMessageTemplate string       `yaml:"commit_msg_template,omitempty" json:"commit_msg_template,omitempty"`
   360  	Caveats               string       `yaml:"caveats,omitempty" json:"caveats,omitempty"`
   361  	ShortDescription      string       `yaml:"short_description,omitempty" json:"short_description,omitempty"`
   362  	Description           string       `yaml:"description,omitempty" json:"description,omitempty"`
   363  	Homepage              string       `yaml:"homepage,omitempty" json:"homepage,omitempty"`
   364  	URLTemplate           string       `yaml:"url_template,omitempty" json:"url_template,omitempty"`
   365  	Goarm                 string       `yaml:"goarm,omitempty" json:"goarm,omitempty" jsonschema:"oneof_type=string;integer"`
   366  	Goamd64               string       `yaml:"goamd64,omitempty" json:"goamd64,omitempty"`
   367  	SkipUpload            string       `yaml:"skip_upload,omitempty" json:"skip_upload,omitempty" jsonschema:"oneof_type=string;boolean"`
   368  
   369  	// Deprecated: use Repository instead.
   370  	Index RepoRef `yaml:"index,omitempty" json:"index,omitempty" jsonschema:"deprecated=true,description=use repository instead"`
   371  }
   372  
   373  // Ko contains the ko section
   374  type Ko struct {
   375  	ID                  string            `yaml:"id,omitempty" json:"id,omitempty"`
   376  	Build               string            `yaml:"build,omitempty" json:"build,omitempty"`
   377  	Main                string            `yaml:"main,omitempty" json:"main,omitempty"`
   378  	WorkingDir          string            `yaml:"working_dir,omitempty" json:"working_dir,omitempty"`
   379  	BaseImage           string            `yaml:"base_image,omitempty" json:"base_image,omitempty"`
   380  	Labels              map[string]string `yaml:"labels,omitempty" json:"labels,omitempty"`
   381  	Repository          string            `yaml:"repository,omitempty" json:"repository,omitempty"`
   382  	Platforms           []string          `yaml:"platforms,omitempty" json:"platforms,omitempty"`
   383  	Tags                []string          `yaml:"tags,omitempty" json:"tags,omitempty"`
   384  	CreationTime        string            `yaml:"creation_time,omitempty" json:"creation_time,omitempty"`
   385  	KoDataCreationTime  string            `yaml:"ko_data_creation_time,omitempty" json:"ko_data_creation_time,omitempty"`
   386  	SBOM                string            `yaml:"sbom,omitempty" json:"sbom,omitempty"`
   387  	Ldflags             []string          `yaml:"ldflags,omitempty" json:"ldflags,omitempty"`
   388  	Flags               []string          `yaml:"flags,omitempty" json:"flags,omitempty"`
   389  	Env                 []string          `yaml:"env,omitempty" json:"env,omitempty"`
   390  	Bare                bool              `yaml:"bare,omitempty" json:"bare,omitempty"`
   391  	PreserveImportPaths bool              `yaml:"preserve_import_paths,omitempty" json:"preserve_import_paths,omitempty"`
   392  	BaseImportPaths     bool              `yaml:"base_import_paths,omitempty" json:"base_import_paths,omitempty"`
   393  }
   394  
   395  // Scoop contains the scoop.sh section.
   396  type Scoop struct {
   397  	Name                  string       `yaml:"name,omitempty" json:"name,omitempty"`
   398  	IDs                   []string     `yaml:"ids,omitempty" json:"ids,omitempty"`
   399  	Repository            RepoRef      `yaml:"repository,omitempty" json:"repository,omitempty"`
   400  	Directory             string       `yaml:"directory,omitempty" json:"directory,omitempty"`
   401  	CommitAuthor          CommitAuthor `yaml:"commit_author,omitempty" json:"commit_author,omitempty"`
   402  	CommitMessageTemplate string       `yaml:"commit_msg_template,omitempty" json:"commit_msg_template,omitempty"`
   403  	Homepage              string       `yaml:"homepage,omitempty" json:"homepage,omitempty"`
   404  	Description           string       `yaml:"description,omitempty" json:"description,omitempty"`
   405  	License               string       `yaml:"license,omitempty" json:"license,omitempty"`
   406  	URLTemplate           string       `yaml:"url_template,omitempty" json:"url_template,omitempty"`
   407  	Persist               []string     `yaml:"persist,omitempty" json:"persist,omitempty"`
   408  	SkipUpload            string       `yaml:"skip_upload,omitempty" json:"skip_upload,omitempty" jsonschema:"oneof_type=string;boolean"`
   409  	PreInstall            []string     `yaml:"pre_install,omitempty" json:"pre_install,omitempty"`
   410  	PostInstall           []string     `yaml:"post_install,omitempty" json:"post_install,omitempty"`
   411  	Depends               []string     `yaml:"depends,omitempty" json:"depends,omitempty"`
   412  	Shortcuts             [][]string   `yaml:"shortcuts,omitempty" json:"shortcuts,omitempty"`
   413  	Goamd64               string       `yaml:"goamd64,omitempty" json:"goamd64,omitempty"`
   414  
   415  	// Deprecated: use Repository instead.
   416  	Bucket RepoRef `yaml:"bucket,omitempty" json:"bucket,omitempty" jsonschema:"deprecated=true,description=use repository instead"`
   417  
   418  	// Deprecated: use Directory instead.
   419  	Folder string `yaml:"folder,omitempty" json:"folder,omitempty" jsonschema:"deprecated=true"`
   420  }
   421  
   422  // CommitAuthor is the author of a Git commit.
   423  type CommitAuthor struct {
   424  	Name  string `yaml:"name,omitempty" json:"name,omitempty"`
   425  	Email string `yaml:"email,omitempty" json:"email,omitempty"`
   426  }
   427  
   428  // BuildHooks define actions to run before and/or after something.
   429  type BuildHooks struct { // renamed on pro
   430  	Pre  string `yaml:"pre,omitempty" json:"pre,omitempty"`
   431  	Post string `yaml:"post,omitempty" json:"post,omitempty"`
   432  }
   433  
   434  // IgnoredBuild represents a build ignored by the user.
   435  type IgnoredBuild struct {
   436  	Goos    string `yaml:"goos,omitempty" json:"goos,omitempty"`
   437  	Goarch  string `yaml:"goarch,omitempty" json:"goarch,omitempty"`
   438  	Goarm   string `yaml:"goarm,omitempty" json:"goarm,omitempty" jsonschema:"oneof_type=string;integer"`
   439  	Gomips  string `yaml:"gomips,omitempty" json:"gomips,omitempty"`
   440  	Goamd64 string `yaml:"goamd64,omitempty" json:"goamd64,omitempty"`
   441  }
   442  
   443  // StringArray is a wrapper for an array of strings.
   444  type StringArray []string
   445  
   446  // UnmarshalYAML is a custom unmarshaler that wraps strings in arrays.
   447  func (a *StringArray) UnmarshalYAML(unmarshal func(interface{}) error) error {
   448  	var strings []string
   449  	if err := unmarshal(&strings); err != nil {
   450  		var str string
   451  		if err := unmarshal(&str); err != nil {
   452  			return err
   453  		}
   454  		*a = []string{str}
   455  	} else {
   456  		*a = strings
   457  	}
   458  	return nil
   459  }
   460  
   461  func (a StringArray) JSONSchema() *jsonschema.Schema {
   462  	return &jsonschema.Schema{
   463  		OneOf: []*jsonschema.Schema{{
   464  			Type: "string",
   465  		}, {
   466  			Type: "array",
   467  			Items: &jsonschema.Schema{
   468  				Type: "string",
   469  			},
   470  		}},
   471  	}
   472  }
   473  
   474  // FlagArray is a wrapper for an array of strings.
   475  type FlagArray []string
   476  
   477  // UnmarshalYAML is a custom unmarshaler that wraps strings in arrays.
   478  func (a *FlagArray) UnmarshalYAML(unmarshal func(interface{}) error) error {
   479  	var flags []string
   480  	if err := unmarshal(&flags); err != nil {
   481  		var flagstr string
   482  		if err := unmarshal(&flagstr); err != nil {
   483  			return err
   484  		}
   485  		*a = strings.Fields(flagstr)
   486  	} else {
   487  		*a = flags
   488  	}
   489  	return nil
   490  }
   491  
   492  func (a FlagArray) JSONSchema() *jsonschema.Schema {
   493  	return &jsonschema.Schema{
   494  		OneOf: []*jsonschema.Schema{{
   495  			Type: "string",
   496  		}, {
   497  			Type: "array",
   498  			Items: &jsonschema.Schema{
   499  				Type: "string",
   500  			},
   501  		}},
   502  	}
   503  }
   504  
   505  // Build contains the build configuration section.
   506  type Build struct {
   507  	ID              string          `yaml:"id,omitempty" json:"id,omitempty"`
   508  	Goos            []string        `yaml:"goos,omitempty" json:"goos,omitempty"`
   509  	Goarch          []string        `yaml:"goarch,omitempty" json:"goarch,omitempty"`
   510  	Goarm           []string        `yaml:"goarm,omitempty" json:"goarm,omitempty"`
   511  	Gomips          []string        `yaml:"gomips,omitempty" json:"gomips,omitempty"`
   512  	Goamd64         []string        `yaml:"goamd64,omitempty" json:"goamd64,omitempty"`
   513  	Targets         []string        `yaml:"targets,omitempty" json:"targets,omitempty"`
   514  	Ignore          []IgnoredBuild  `yaml:"ignore,omitempty" json:"ignore,omitempty"`
   515  	Dir             string          `yaml:"dir,omitempty" json:"dir,omitempty"`
   516  	Main            string          `yaml:"main,omitempty" json:"main,omitempty"`
   517  	Binary          string          `yaml:"binary,omitempty" json:"binary,omitempty"`
   518  	Hooks           BuildHookConfig `yaml:"hooks,omitempty" json:"hooks,omitempty"`
   519  	Builder         string          `yaml:"builder,omitempty" json:"builder,omitempty"`
   520  	ModTimestamp    string          `yaml:"mod_timestamp,omitempty" json:"mod_timestamp,omitempty"`
   521  	Skip            bool            `yaml:"skip,omitempty" json:"skip,omitempty"`
   522  	GoBinary        string          `yaml:"gobinary,omitempty" json:"gobinary,omitempty"`
   523  	Command         string          `yaml:"command,omitempty" json:"command,omitempty"`
   524  	NoUniqueDistDir bool            `yaml:"no_unique_dist_dir,omitempty" json:"no_unique_dist_dir,omitempty"`
   525  	NoMainCheck     bool            `yaml:"no_main_check,omitempty" json:"no_main_check,omitempty"`
   526  	UnproxiedMain   string          `yaml:"-" json:"-"` // used by gomod.proxy
   527  	UnproxiedDir    string          `yaml:"-" json:"-"` // used by gomod.proxy
   528  
   529  	BuildDetails          `yaml:",inline" json:",inline"` // nolint: tagliatelle
   530  	BuildDetailsOverrides []BuildDetailsOverride          `yaml:"overrides,omitempty" json:"overrides,omitempty"`
   531  }
   532  
   533  type BuildDetailsOverride struct {
   534  	Goos         string                          `yaml:"goos,omitempty" json:"goos,omitempty"`
   535  	Goarch       string                          `yaml:"goarch,omitempty" json:"goarch,omitempty"`
   536  	Goarm        string                          `yaml:"goarm,omitempty" json:"goarm,omitempty" jsonschema:"oneof_type=string;integer"`
   537  	Gomips       string                          `yaml:"gomips,omitempty" json:"gomips,omitempty"`
   538  	Goamd64      string                          `yaml:"goamd64,omitempty" json:"goamd64,omitempty"`
   539  	BuildDetails `yaml:",inline" json:",inline"` // nolint: tagliatelle
   540  }
   541  
   542  type BuildDetails struct {
   543  	Buildmode string      `yaml:"buildmode,omitempty" json:"buildmode,omitempty" jsonschema:"enum=c-archive,enum=c-shared,enum=pie,enum=,default="`
   544  	Ldflags   StringArray `yaml:"ldflags,omitempty" json:"ldflags,omitempty"`
   545  	Tags      FlagArray   `yaml:"tags,omitempty" json:"tags,omitempty"`
   546  	Flags     FlagArray   `yaml:"flags,omitempty" json:"flags,omitempty"`
   547  	Asmflags  StringArray `yaml:"asmflags,omitempty" json:"asmflags,omitempty"`
   548  	Gcflags   StringArray `yaml:"gcflags,omitempty" json:"gcflags,omitempty"`
   549  	Env       []string    `yaml:"env,omitempty" json:"env,omitempty"`
   550  }
   551  
   552  type BuildHookConfig struct {
   553  	Pre  Hooks `yaml:"pre,omitempty" json:"pre,omitempty"`
   554  	Post Hooks `yaml:"post,omitempty" json:"post,omitempty"`
   555  }
   556  
   557  type Hooks []Hook
   558  
   559  // UnmarshalYAML is a custom unmarshaler that allows simplified declaration of single command.
   560  func (bhc *Hooks) UnmarshalYAML(unmarshal func(interface{}) error) error {
   561  	var singleCmd string
   562  	err := unmarshal(&singleCmd)
   563  	if err == nil {
   564  		*bhc = []Hook{{Cmd: singleCmd}}
   565  		return nil
   566  	}
   567  
   568  	type t Hooks
   569  	var hooks t
   570  	if err := unmarshal(&hooks); err != nil {
   571  		return err
   572  	}
   573  	*bhc = (Hooks)(hooks)
   574  	return nil
   575  }
   576  
   577  func (bhc Hooks) JSONSchema() *jsonschema.Schema {
   578  	reflector := jsonschema.Reflector{
   579  		ExpandedStruct: true,
   580  	}
   581  	var t Hook
   582  	schema := reflector.Reflect(&t)
   583  	return &jsonschema.Schema{
   584  		OneOf: []*jsonschema.Schema{{
   585  			Type: "string",
   586  		}, {
   587  			Type:  "array",
   588  			Items: schema,
   589  		}},
   590  	}
   591  }
   592  
   593  type Hook struct {
   594  	Dir    string   `yaml:"dir,omitempty" json:"dir,omitempty"`
   595  	Cmd    string   `yaml:"cmd,omitempty" json:"cmd,omitempty"`
   596  	Env    []string `yaml:"env,omitempty" json:"env,omitempty"`
   597  	Output bool     `yaml:"output,omitempty" json:"output,omitempty"`
   598  }
   599  
   600  // UnmarshalYAML is a custom unmarshaler that allows simplified declarations of commands as strings.
   601  func (bh *Hook) UnmarshalYAML(unmarshal func(interface{}) error) error {
   602  	var cmd string
   603  	if err := unmarshal(&cmd); err != nil {
   604  		type t Hook
   605  		var hook t
   606  		if err := unmarshal(&hook); err != nil {
   607  			return err
   608  		}
   609  		*bh = (Hook)(hook)
   610  		return nil
   611  	}
   612  
   613  	bh.Cmd = cmd
   614  	return nil
   615  }
   616  
   617  func (bh Hook) JSONSchema() *jsonschema.Schema {
   618  	type hookAlias Hook
   619  	reflector := jsonschema.Reflector{
   620  		ExpandedStruct: true,
   621  	}
   622  	schema := reflector.Reflect(&hookAlias{})
   623  	return &jsonschema.Schema{
   624  		OneOf: []*jsonschema.Schema{
   625  			{
   626  				Type: "string",
   627  			},
   628  			schema,
   629  		},
   630  	}
   631  }
   632  
   633  // FormatOverride is used to specify a custom format for a specific GOOS.
   634  type FormatOverride struct {
   635  	Goos   string `yaml:"goos,omitempty" json:"goos,omitempty"`
   636  	Format string `yaml:"format,omitempty" json:"format,omitempty" jsonschema:"enum=tar,enum=tgz,enum=tar.gz,enum=zip,enum=gz,enum=tar.xz,enum=txz,enum=binary,enum=none,default=tar.gz"`
   637  }
   638  
   639  // File is a file inside an archive.
   640  type File struct {
   641  	Source      string   `yaml:"src,omitempty" json:"src,omitempty"`
   642  	Destination string   `yaml:"dst,omitempty" json:"dst,omitempty"`
   643  	StripParent bool     `yaml:"strip_parent,omitempty" json:"strip_parent,omitempty"`
   644  	Info        FileInfo `yaml:"info,omitempty" json:"info,omitempty"`
   645  	Default     bool     `yaml:"-" json:"-"`
   646  }
   647  
   648  // FileInfo is the file info of a file.
   649  type FileInfo struct {
   650  	Owner       string      `yaml:"owner,omitempty" json:"owner,omitempty"`
   651  	Group       string      `yaml:"group,omitempty" json:"group,omitempty"`
   652  	Mode        os.FileMode `yaml:"mode,omitempty" json:"mode,omitempty"`
   653  	MTime       string      `yaml:"mtime,omitempty" json:"mtime,omitempty"`
   654  	ParsedMTime time.Time   `yaml:"-" json:"-"`
   655  }
   656  
   657  // UnmarshalYAML is a custom unmarshaler that wraps strings in arrays.
   658  func (f *File) UnmarshalYAML(unmarshal func(interface{}) error) error {
   659  	type t File
   660  	var str string
   661  	if err := unmarshal(&str); err == nil {
   662  		*f = File{Source: str}
   663  		return nil
   664  	}
   665  
   666  	var file t
   667  	if err := unmarshal(&file); err != nil {
   668  		return err
   669  	}
   670  	*f = File(file)
   671  	return nil
   672  }
   673  
   674  func (f File) JSONSchema() *jsonschema.Schema {
   675  	type fileAlias File
   676  	reflector := jsonschema.Reflector{
   677  		ExpandedStruct: true,
   678  	}
   679  	schema := reflector.Reflect(&fileAlias{})
   680  	return &jsonschema.Schema{
   681  		OneOf: []*jsonschema.Schema{
   682  			{
   683  				Type: "string",
   684  			},
   685  			schema,
   686  		},
   687  	}
   688  }
   689  
   690  // UniversalBinary setups macos universal binaries.
   691  type UniversalBinary struct {
   692  	ID           string          `yaml:"id,omitempty" json:"id,omitempty"`
   693  	IDs          []string        `yaml:"ids,omitempty" json:"ids,omitempty"`
   694  	NameTemplate string          `yaml:"name_template,omitempty" json:"name_template,omitempty"`
   695  	Replace      bool            `yaml:"replace,omitempty" json:"replace,omitempty"`
   696  	Hooks        BuildHookConfig `yaml:"hooks,omitempty" json:"hooks,omitempty"`
   697  	ModTimestamp string          `yaml:"mod_timestamp,omitempty" json:"mod_timestamp,omitempty"`
   698  }
   699  
   700  // UPX allows to compress binaries with `upx`.
   701  type UPX struct {
   702  	Enabled  string   `yaml:"enabled,omitempty" json:"enabled,omitempty" jsonschema:"oneof_type=string;boolean"`
   703  	IDs      []string `yaml:"ids,omitempty" json:"ids,omitempty"`
   704  	Goos     []string `yaml:"goos,omitempty" json:"goos,omitempty"`
   705  	Goarch   []string `yaml:"goarch,omitempty" json:"goarch,omitempty"`
   706  	Goarm    []string `yaml:"goarm,omitempty" json:"goarm,omitempty"`
   707  	Goamd64  []string `yaml:"goamd64,omitempty" json:"goamd64,omitempty"`
   708  	Binary   string   `yaml:"binary,omitempty" json:"binary,omitempty"`
   709  	Compress string   `yaml:"compress,omitempty" json:"compress,omitempty" jsonschema:"enum=1,enum=2,enum=3,enum=4,enum=5,enum=6,enum=7,enum=8,enum=9,enum=best,enum=,default="`
   710  	LZMA     bool     `yaml:"lzma,omitempty" json:"lzma,omitempty"`
   711  	Brute    bool     `yaml:"brute,omitempty" json:"brute,omitempty"`
   712  }
   713  
   714  // Archive config used for the archive.
   715  type Archive struct {
   716  	ID                        string           `yaml:"id,omitempty" json:"id,omitempty"`
   717  	Builds                    []string         `yaml:"builds,omitempty" json:"builds,omitempty"`
   718  	BuildsInfo                FileInfo         `yaml:"builds_info,omitempty" json:"builds_info,omitempty"`
   719  	NameTemplate              string           `yaml:"name_template,omitempty" json:"name_template,omitempty"`
   720  	Format                    string           `yaml:"format,omitempty" json:"format,omitempty" jsonschema:"enum=tar,enum=tgz,enum=tar.gz,enum=zip,enum=gz,enum=tar.xz,enum=txz,enum=binary,default=tar.gz"`
   721  	FormatOverrides           []FormatOverride `yaml:"format_overrides,omitempty" json:"format_overrides,omitempty"`
   722  	WrapInDirectory           string           `yaml:"wrap_in_directory,omitempty" json:"wrap_in_directory,omitempty" jsonschema:"oneof_type=string;boolean"`
   723  	StripBinaryDirectory      bool             `yaml:"strip_binary_directory,omitempty" json:"strip_binary_directory,omitempty"`
   724  	Files                     []File           `yaml:"files,omitempty" json:"files,omitempty"`
   725  	Meta                      bool             `yaml:"meta,omitempty" json:"meta,omitempty"`
   726  	AllowDifferentBinaryCount bool             `yaml:"allow_different_binary_count,omitempty" json:"allow_different_binary_count,omitempty"`
   727  
   728  	// Deprecated: don't need to set this anymore.
   729  	RLCP string `yaml:"rlcp,omitempty" json:"rlcp,omitempty"  jsonschema:"oneof_type=string;boolean,deprecated=true,description=you can now remove this"`
   730  
   731  	// Deprecated: use StripBinaryDirectory instead.
   732  	StripParentBinaryFolder bool `yaml:"strip_parent_binary_folder,omitempty" json:"strip_parent_binary_folder,omitempty" jsonschema:"deprecated=true"`
   733  }
   734  
   735  type ReleaseNotesMode string
   736  
   737  const (
   738  	ReleaseNotesModeKeepExisting ReleaseNotesMode = "keep-existing"
   739  	ReleaseNotesModeAppend       ReleaseNotesMode = "append"
   740  	ReleaseNotesModeReplace      ReleaseNotesMode = "replace"
   741  	ReleaseNotesModePrepend      ReleaseNotesMode = "prepend"
   742  )
   743  
   744  // Release config used for the GitHub/GitLab release.
   745  type Release struct {
   746  	GitHub                 Repo        `yaml:"github,omitempty" json:"github,omitempty"`
   747  	GitLab                 Repo        `yaml:"gitlab,omitempty" json:"gitlab,omitempty"`
   748  	Gitea                  Repo        `yaml:"gitea,omitempty" json:"gitea,omitempty"`
   749  	Draft                  bool        `yaml:"draft,omitempty" json:"draft,omitempty"`
   750  	ReplaceExistingDraft   bool        `yaml:"replace_existing_draft,omitempty" json:"replace_existing_draft,omitempty"`
   751  	TargetCommitish        string      `yaml:"target_commitish,omitempty" json:"target_commitish,omitempty"`
   752  	Disable                string      `yaml:"disable,omitempty" json:"disable,omitempty" jsonschema:"oneof_type=string;boolean"`
   753  	SkipUpload             string      `yaml:"skip_upload,omitempty" json:"skip_upload,omitempty" jsonschema:"oneof_type=string;boolean"`
   754  	Prerelease             string      `yaml:"prerelease,omitempty" json:"prerelease,omitempty"`
   755  	MakeLatest             string      `yaml:"make_latest,omitempty" json:"make_latest,omitempty" jsonschema:"oneof_type=string;boolean"`
   756  	NameTemplate           string      `yaml:"name_template,omitempty" json:"name_template,omitempty"`
   757  	IDs                    []string    `yaml:"ids,omitempty" json:"ids,omitempty"`
   758  	ExtraFiles             []ExtraFile `yaml:"extra_files,omitempty" json:"extra_files,omitempty"`
   759  	DiscussionCategoryName string      `yaml:"discussion_category_name,omitempty" json:"discussion_category_name,omitempty"`
   760  	Header                 string      `yaml:"header,omitempty" json:"header,omitempty"`
   761  	Footer                 string      `yaml:"footer,omitempty" json:"footer,omitempty"`
   762  
   763  	ReleaseNotesMode         ReleaseNotesMode `yaml:"mode,omitempty" json:"mode,omitempty" jsonschema:"enum=keep-existing,enum=append,enum=prepend,enum=replace,default=keep-existing"`
   764  	ReplaceExistingArtifacts bool             `yaml:"replace_existing_artifacts,omitempty" json:"replace_existing_artifacts,omitempty"`
   765  	IncludeMeta              bool             `yaml:"include_meta,omitempty" json:"include_meta,omitempty"`
   766  }
   767  
   768  // Milestone config used for VCS milestone.
   769  type Milestone struct {
   770  	Repo         Repo   `yaml:"repo,omitempty" json:"repo,omitempty"`
   771  	Close        bool   `yaml:"close,omitempty" json:"close,omitempty"`
   772  	FailOnError  bool   `yaml:"fail_on_error,omitempty" json:"fail_on_error,omitempty"`
   773  	NameTemplate string `yaml:"name_template,omitempty" json:"name_template,omitempty"`
   774  }
   775  
   776  // ExtraFile on a release.
   777  type ExtraFile struct {
   778  	Glob         string `yaml:"glob,omitempty" json:"glob,omitempty"`
   779  	NameTemplate string `yaml:"name_template,omitempty" json:"name_template,omitempty"`
   780  }
   781  
   782  // NFPM config.
   783  type NFPM struct {
   784  	NFPMOverridables `yaml:",inline" json:",inline"` // nolint: tagliatelle
   785  	Overrides        map[string]NFPMOverridables     `yaml:"overrides,omitempty" json:"overrides,omitempty"`
   786  
   787  	ID          string   `yaml:"id,omitempty" json:"id,omitempty"`
   788  	Builds      []string `yaml:"builds,omitempty" json:"builds,omitempty"`
   789  	Formats     []string `yaml:"formats,omitempty" json:"formats,omitempty" jsonschema:"enum=apk,enum=deb,enum=rpm,enum=termux.deb,enum=archlinux"`
   790  	Section     string   `yaml:"section,omitempty" json:"section,omitempty"`
   791  	Priority    string   `yaml:"priority,omitempty" json:"priority,omitempty"`
   792  	Vendor      string   `yaml:"vendor,omitempty" json:"vendor,omitempty"`
   793  	Homepage    string   `yaml:"homepage,omitempty" json:"homepage,omitempty"`
   794  	Maintainer  string   `yaml:"maintainer,omitempty" json:"maintainer,omitempty"`
   795  	Description string   `yaml:"description,omitempty" json:"description,omitempty"`
   796  	License     string   `yaml:"license,omitempty" json:"license,omitempty"`
   797  	Bindir      string   `yaml:"bindir,omitempty" json:"bindir,omitempty"`
   798  	Libdirs     Libdirs  `yaml:"libdirs,omitempty" json:"libdirs,omitempty"`
   799  	Changelog   string   `yaml:"changelog,omitempty" json:"changelog,omitempty"`
   800  	Meta        bool     `yaml:"meta,omitempty" json:"meta,omitempty"` // make package without binaries - only deps
   801  }
   802  
   803  type Libdirs struct {
   804  	Header   string `yaml:"header,omitempty" json:"header,omitempty"`
   805  	CArchive string `yaml:"carchive,omitempty" json:"carchive,omitempty"`
   806  	CShared  string `yaml:"cshared,omitempty" json:"cshared,omitempty"`
   807  }
   808  
   809  // NFPMScripts is used to specify maintainer scripts.
   810  type NFPMScripts struct {
   811  	PreInstall  string `yaml:"preinstall,omitempty" json:"preinstall,omitempty"`
   812  	PostInstall string `yaml:"postinstall,omitempty" json:"postinstall,omitempty"`
   813  	PreRemove   string `yaml:"preremove,omitempty" json:"preremove,omitempty"`
   814  	PostRemove  string `yaml:"postremove,omitempty" json:"postremove,omitempty"`
   815  }
   816  
   817  type NFPMRPMSignature struct {
   818  	// PGP secret key, can be ASCII-armored
   819  	KeyFile       string `yaml:"key_file,omitempty" json:"key_file,omitempty"`
   820  	KeyPassphrase string `yaml:"-" json:"-"` // populated from environment variable
   821  }
   822  
   823  // NFPMRPMScripts represents scripts only available on RPM packages.
   824  type NFPMRPMScripts struct {
   825  	PreTrans  string `yaml:"pretrans,omitempty" json:"pretrans,omitempty"`
   826  	PostTrans string `yaml:"posttrans,omitempty" json:"posttrans,omitempty"`
   827  }
   828  
   829  // NFPMRPM is custom configs that are only available on RPM packages.
   830  type NFPMRPM struct {
   831  	Summary     string           `yaml:"summary,omitempty" json:"summary,omitempty"`
   832  	Group       string           `yaml:"group,omitempty" json:"group,omitempty"`
   833  	Compression string           `yaml:"compression,omitempty" json:"compression,omitempty"`
   834  	Signature   NFPMRPMSignature `yaml:"signature,omitempty" json:"signature,omitempty"`
   835  	Scripts     NFPMRPMScripts   `yaml:"scripts,omitempty" json:"scripts,omitempty"`
   836  	Prefixes    []string         `yaml:"prefixes,omitempty" json:"prefixes,omitempty"`
   837  	Packager    string           `yaml:"packager,omitempty" json:"packager,omitempty"`
   838  }
   839  
   840  // NFPMDebScripts is scripts only available on deb packages.
   841  type NFPMDebScripts struct {
   842  	Rules     string `yaml:"rules,omitempty" json:"rules,omitempty"`
   843  	Templates string `yaml:"templates,omitempty" json:"templates,omitempty"`
   844  }
   845  
   846  // NFPMDebTriggers contains triggers only available for deb packages.
   847  // https://wiki.debian.org/DpkgTriggers
   848  // https://man7.org/linux/man-pages/man5/deb-triggers.5.html
   849  type NFPMDebTriggers struct {
   850  	Interest        []string `yaml:"interest,omitempty" json:"interest,omitempty"`
   851  	InterestAwait   []string `yaml:"interest_await,omitempty" json:"interest_await,omitempty"`
   852  	InterestNoAwait []string `yaml:"interest_noawait,omitempty" json:"interest_noawait,omitempty"`
   853  	Activate        []string `yaml:"activate,omitempty" json:"activate,omitempty"`
   854  	ActivateAwait   []string `yaml:"activate_await,omitempty" json:"activate_await,omitempty"`
   855  	ActivateNoAwait []string `yaml:"activate_noawait,omitempty" json:"activate_noawait,omitempty"`
   856  }
   857  
   858  // NFPMDebSignature contains config for signing deb packages created by nfpm.
   859  type NFPMDebSignature struct {
   860  	// PGP secret key, can be ASCII-armored
   861  	KeyFile       string `yaml:"key_file,omitempty" json:"key_file,omitempty"`
   862  	KeyPassphrase string `yaml:"-" json:"-"` // populated from environment variable
   863  	// origin, maint or archive (defaults to origin)
   864  	Type string `yaml:"type,omitempty" json:"type,omitempty"`
   865  }
   866  
   867  // NFPMDeb is custom configs that are only available on deb packages.
   868  type NFPMDeb struct {
   869  	Scripts     NFPMDebScripts    `yaml:"scripts,omitempty" json:"scripts,omitempty"`
   870  	Triggers    NFPMDebTriggers   `yaml:"triggers,omitempty" json:"triggers,omitempty"`
   871  	Breaks      []string          `yaml:"breaks,omitempty" json:"breaks,omitempty"`
   872  	Signature   NFPMDebSignature  `yaml:"signature,omitempty" json:"signature,omitempty"`
   873  	Lintian     []string          `yaml:"lintian_overrides,omitempty" json:"lintian_overrides,omitempty"`
   874  	Compression string            `yaml:"compression,omitempty" json:"compression,omitempty" jsonschema:"enum=gzip,enum=xz,enum=none,default=gzip"`
   875  	Fields      map[string]string `yaml:"fields,omitempty" json:"fields,omitempty"`
   876  	Predepends  []string          `yaml:"predepends,omitempty" json:"predepends,omitempty"`
   877  }
   878  
   879  type NFPMAPKScripts struct {
   880  	PreUpgrade  string `yaml:"preupgrade,omitempty" json:"preupgrade,omitempty"`
   881  	PostUpgrade string `yaml:"postupgrade,omitempty" json:"postupgrade,omitempty"`
   882  }
   883  
   884  // NFPMAPKSignature contains config for signing apk packages created by nfpm.
   885  type NFPMAPKSignature struct {
   886  	// RSA private key in PEM format
   887  	KeyFile       string `yaml:"key_file,omitempty" json:"key_file,omitempty"`
   888  	KeyPassphrase string `yaml:"-" json:"-"` // populated from environment variable
   889  	// defaults to <maintainer email>.rsa.pub
   890  	KeyName string `yaml:"key_name,omitempty" json:"key_name,omitempty"`
   891  }
   892  
   893  // NFPMAPK is custom config only available on apk packages.
   894  type NFPMAPK struct {
   895  	Scripts   NFPMAPKScripts   `yaml:"scripts,omitempty" json:"scripts,omitempty"`
   896  	Signature NFPMAPKSignature `yaml:"signature,omitempty" json:"signature,omitempty"`
   897  }
   898  
   899  type NFPMArchLinuxScripts struct {
   900  	PreUpgrade  string `yaml:"preupgrade,omitempty" json:"preupgrade,omitempty"`
   901  	PostUpgrade string `yaml:"postupgrade,omitempty" json:"postupgrade,omitempty"`
   902  }
   903  
   904  type NFPMArchLinux struct {
   905  	Pkgbase  string               `yaml:"pkgbase,omitempty" json:"pkgbase,omitempty"`
   906  	Packager string               `yaml:"packager,omitempty" json:"packager,omitempty"`
   907  	Scripts  NFPMArchLinuxScripts `yaml:"scripts,omitempty" json:"scripts,omitempty"`
   908  }
   909  
   910  // NFPMOverridables is used to specify per package format settings.
   911  type NFPMOverridables struct {
   912  	FileNameTemplate string         `yaml:"file_name_template,omitempty" json:"file_name_template,omitempty"`
   913  	PackageName      string         `yaml:"package_name,omitempty" json:"package_name,omitempty"`
   914  	Epoch            string         `yaml:"epoch,omitempty" json:"epoch,omitempty"`
   915  	Release          string         `yaml:"release,omitempty" json:"release,omitempty"`
   916  	Prerelease       string         `yaml:"prerelease,omitempty" json:"prerelease,omitempty"`
   917  	VersionMetadata  string         `yaml:"version_metadata,omitempty" json:"version_metadata,omitempty"`
   918  	Dependencies     []string       `yaml:"dependencies,omitempty" json:"dependencies,omitempty"`
   919  	Recommends       []string       `yaml:"recommends,omitempty" json:"recommends,omitempty"`
   920  	Suggests         []string       `yaml:"suggests,omitempty" json:"suggests,omitempty"`
   921  	Conflicts        []string       `yaml:"conflicts,omitempty" json:"conflicts,omitempty"`
   922  	Umask            fs.FileMode    `yaml:"umask,omitempty" json:"umask,omitempty"`
   923  	Replaces         []string       `yaml:"replaces,omitempty" json:"replaces,omitempty"`
   924  	Provides         []string       `yaml:"provides,omitempty" json:"provides,omitempty"`
   925  	Contents         files.Contents `yaml:"contents,omitempty" json:"contents,omitempty"`
   926  	Scripts          NFPMScripts    `yaml:"scripts,omitempty" json:"scripts,omitempty"`
   927  	RPM              NFPMRPM        `yaml:"rpm,omitempty" json:"rpm,omitempty"`
   928  	Deb              NFPMDeb        `yaml:"deb,omitempty" json:"deb,omitempty"`
   929  	APK              NFPMAPK        `yaml:"apk,omitempty" json:"apk,omitempty"`
   930  	ArchLinux        NFPMArchLinux  `yaml:"archlinux,omitempty" json:"archlinux,omitempty"`
   931  }
   932  
   933  // SBOM config.
   934  type SBOM struct {
   935  	ID        string   `yaml:"id,omitempty" json:"id,omitempty"`
   936  	Cmd       string   `yaml:"cmd,omitempty" json:"cmd,omitempty"`
   937  	Env       []string `yaml:"env,omitempty" json:"env,omitempty"`
   938  	Args      []string `yaml:"args,omitempty" json:"args,omitempty"`
   939  	Documents []string `yaml:"documents,omitempty" json:"documents,omitempty"`
   940  	Artifacts string   `yaml:"artifacts,omitempty" json:"artifacts,omitempty" jsonschema:"enum=source,enum=package,enum=archive,enum=binary,enum=any,enum=any,default=archive"`
   941  	IDs       []string `yaml:"ids,omitempty" json:"ids,omitempty"`
   942  }
   943  
   944  // Sign config.
   945  type Sign struct {
   946  	ID          string   `yaml:"id,omitempty" json:"id,omitempty"`
   947  	Cmd         string   `yaml:"cmd,omitempty" json:"cmd,omitempty"`
   948  	Args        []string `yaml:"args,omitempty" json:"args,omitempty"`
   949  	Signature   string   `yaml:"signature,omitempty" json:"signature,omitempty"`
   950  	Artifacts   string   `yaml:"artifacts,omitempty" json:"artifacts,omitempty" jsonschema:"enum=all,enum=manifests,enum=images,enum=checksum,enum=source,enum=package,enum=archive,enum=binary,enum=sbom"`
   951  	IDs         []string `yaml:"ids,omitempty" json:"ids,omitempty"`
   952  	Stdin       *string  `yaml:"stdin,omitempty" json:"stdin,omitempty"`
   953  	StdinFile   string   `yaml:"stdin_file,omitempty" json:"stdin_file,omitempty"`
   954  	Env         []string `yaml:"env,omitempty" json:"env,omitempty"`
   955  	Certificate string   `yaml:"certificate,omitempty" json:"certificate,omitempty"`
   956  	Output      bool     `yaml:"output,omitempty" json:"output,omitempty"`
   957  }
   958  
   959  // SnapcraftAppMetadata for the binaries that will be in the snap package.
   960  type SnapcraftAppMetadata struct {
   961  	Command string `yaml:"command" json:"command"`
   962  	Args    string `yaml:"args,omitempty" json:"args,omitempty"`
   963  
   964  	Adapter          string                 `yaml:"adapter,omitempty" json:"adapter,omitempty"`
   965  	After            []string               `yaml:"after,omitempty" json:"after,omitempty"`
   966  	Aliases          []string               `yaml:"aliases,omitempty" json:"aliases,omitempty"`
   967  	Autostart        string                 `yaml:"autostart,omitempty" json:"autostart,omitempty"`
   968  	Before           []string               `yaml:"before,omitempty" json:"before,omitempty"`
   969  	BusName          string                 `yaml:"bus_name,omitempty" json:"bus_name,omitempty"`
   970  	CommandChain     []string               `yaml:"command_chain,omitempty" json:"command_chain,omitempty"`
   971  	CommonID         string                 `yaml:"common_id,omitempty" json:"common_id,omitempty"`
   972  	Completer        string                 `yaml:"completer,omitempty" json:"completer,omitempty"`
   973  	Daemon           string                 `yaml:"daemon,omitempty" json:"daemon,omitempty"`
   974  	Desktop          string                 `yaml:"desktop,omitempty" json:"desktop,omitempty"`
   975  	Environment      map[string]interface{} `yaml:"environment,omitempty" json:"environment,omitempty"`
   976  	Extensions       []string               `yaml:"extensions,omitempty" json:"extensions,omitempty"`
   977  	InstallMode      string                 `yaml:"install_mode,omitempty" json:"install_mode,omitempty"`
   978  	Passthrough      map[string]interface{} `yaml:"passthrough,omitempty" json:"passthrough,omitempty"`
   979  	Plugs            []string               `yaml:"plugs,omitempty" json:"plugs,omitempty"`
   980  	PostStopCommand  string                 `yaml:"post_stop_command,omitempty" json:"post_stop_command,omitempty"`
   981  	RefreshMode      string                 `yaml:"refresh_mode,omitempty" json:"refresh_mode,omitempty"`
   982  	ReloadCommand    string                 `yaml:"reload_command,omitempty" json:"reload_command,omitempty"`
   983  	RestartCondition string                 `yaml:"restart_condition,omitempty" json:"restart_condition,omitempty"`
   984  	RestartDelay     string                 `yaml:"restart_delay,omitempty" json:"restart_delay,omitempty"`
   985  	Slots            []string               `yaml:"slots,omitempty" json:"slots,omitempty"`
   986  	Sockets          map[string]interface{} `yaml:"sockets,omitempty" json:"sockets,omitempty"`
   987  	StartTimeout     string                 `yaml:"start_timeout,omitempty" json:"start_timeout,omitempty"`
   988  	StopCommand      string                 `yaml:"stop_command,omitempty" json:"stop_command,omitempty"`
   989  	StopMode         string                 `yaml:"stop_mode,omitempty" json:"stop_mode,omitempty"`
   990  	StopTimeout      string                 `yaml:"stop_timeout,omitempty" json:"stop_timeout,omitempty"`
   991  	Timer            string                 `yaml:"timer,omitempty" json:"timer,omitempty"`
   992  	WatchdogTimeout  string                 `yaml:"watchdog_timeout,omitempty" json:"watchdog_timeout,omitempty"`
   993  }
   994  
   995  type SnapcraftLayoutMetadata struct {
   996  	Symlink  string `yaml:"symlink,omitempty" json:"symlink,omitempty"`
   997  	Bind     string `yaml:"bind,omitempty" json:"bind,omitempty"`
   998  	BindFile string `yaml:"bind_file,omitempty" json:"bind_file,omitempty"`
   999  	Type     string `yaml:"type,omitempty" json:"type,omitempty"`
  1000  }
  1001  
  1002  // Snapcraft config.
  1003  type Snapcraft struct {
  1004  	NameTemplate     string                             `yaml:"name_template,omitempty" json:"name_template,omitempty"`
  1005  	Publish          bool                               `yaml:"publish,omitempty" json:"publish,omitempty"`
  1006  	ID               string                             `yaml:"id,omitempty" json:"id,omitempty"`
  1007  	Builds           []string                           `yaml:"builds,omitempty" json:"builds,omitempty"`
  1008  	Name             string                             `yaml:"name,omitempty" json:"name,omitempty"`
  1009  	Title            string                             `yaml:"title,omitempty" json:"title,omitempty"`
  1010  	Summary          string                             `yaml:"summary,omitempty" json:"summary,omitempty"`
  1011  	Description      string                             `yaml:"description,omitempty" json:"description,omitempty"`
  1012  	Icon             string                             `yaml:"icon,omitempty" json:"icon,omitempty"`
  1013  	Base             string                             `yaml:"base,omitempty" json:"base,omitempty"`
  1014  	License          string                             `yaml:"license,omitempty" json:"license,omitempty"`
  1015  	Grade            string                             `yaml:"grade,omitempty" json:"grade,omitempty"`
  1016  	ChannelTemplates []string                           `yaml:"channel_templates,omitempty" json:"channel_templates,omitempty"`
  1017  	Confinement      string                             `yaml:"confinement,omitempty" json:"confinement,omitempty"`
  1018  	Assumes          []string                           `yaml:"assumes,omitempty" json:"assumes,omitempty"`
  1019  	Layout           map[string]SnapcraftLayoutMetadata `yaml:"layout,omitempty" json:"layout,omitempty"`
  1020  	Apps             map[string]SnapcraftAppMetadata    `yaml:"apps,omitempty" json:"apps,omitempty"`
  1021  	Hooks            map[string]interface{}             `yaml:"hooks,omitempty" json:"hooks,omitempty"`
  1022  	Plugs            map[string]interface{}             `yaml:"plugs,omitempty" json:"plugs,omitempty"`
  1023  	Disable          string                             `yaml:"disable,omitempty" json:"disable,omitempty" jsonschema:"oneof_type=string;boolean"`
  1024  
  1025  	Files []SnapcraftExtraFiles `yaml:"extra_files,omitempty" json:"extra_files,omitempty"`
  1026  }
  1027  
  1028  // SnapcraftExtraFiles config.
  1029  type SnapcraftExtraFiles struct {
  1030  	Source      string `yaml:"source" json:"source"`
  1031  	Destination string `yaml:"destination,omitempty" json:"destination,omitempty"`
  1032  	Mode        uint32 `yaml:"mode,omitempty" json:"mode,omitempty"`
  1033  }
  1034  
  1035  // Snapshot config.
  1036  type Snapshot struct {
  1037  	NameTemplate string `yaml:"name_template,omitempty" json:"name_template,omitempty"`
  1038  }
  1039  
  1040  // Checksum config.
  1041  type Checksum struct {
  1042  	NameTemplate string      `yaml:"name_template,omitempty" json:"name_template,omitempty"`
  1043  	Algorithm    string      `yaml:"algorithm,omitempty" json:"algorithm,omitempty"`
  1044  	Split        bool        `yaml:"split,omitempty" json:"split,omitempty"`
  1045  	IDs          []string    `yaml:"ids,omitempty" json:"ids,omitempty"`
  1046  	Disable      bool        `yaml:"disable,omitempty" json:"disable,omitempty"`
  1047  	ExtraFiles   []ExtraFile `yaml:"extra_files,omitempty" json:"extra_files,omitempty"`
  1048  }
  1049  
  1050  // Docker image config.
  1051  type Docker struct {
  1052  	ID                 string   `yaml:"id,omitempty" json:"id,omitempty"`
  1053  	IDs                []string `yaml:"ids,omitempty" json:"ids,omitempty"`
  1054  	Goos               string   `yaml:"goos,omitempty" json:"goos,omitempty"`
  1055  	Goarch             string   `yaml:"goarch,omitempty" json:"goarch,omitempty"`
  1056  	Goarm              string   `yaml:"goarm,omitempty" json:"goarm,omitempty" jsonschema:"oneof_type=string;integer"`
  1057  	Goamd64            string   `yaml:"goamd64,omitempty" json:"goamd64,omitempty"`
  1058  	Dockerfile         string   `yaml:"dockerfile,omitempty" json:"dockerfile,omitempty"`
  1059  	ImageTemplates     []string `yaml:"image_templates,omitempty" json:"image_templates,omitempty"`
  1060  	SkipPush           string   `yaml:"skip_push,omitempty" json:"skip_push,omitempty" jsonschema:"oneof_type=string;boolean"`
  1061  	Files              []string `yaml:"extra_files,omitempty" json:"extra_files,omitempty"`
  1062  	BuildFlagTemplates []string `yaml:"build_flag_templates,omitempty" json:"build_flag_templates,omitempty"`
  1063  	PushFlags          []string `yaml:"push_flags,omitempty" json:"push_flags,omitempty"`
  1064  	Use                string   `yaml:"use,omitempty" json:"use,omitempty" jsonschema:"enum=docker,enum=buildx,default=docker"`
  1065  }
  1066  
  1067  // DockerManifest config.
  1068  type DockerManifest struct {
  1069  	ID             string   `yaml:"id,omitempty" json:"id,omitempty"`
  1070  	NameTemplate   string   `yaml:"name_template,omitempty" json:"name_template,omitempty"`
  1071  	SkipPush       string   `yaml:"skip_push,omitempty" json:"skip_push,omitempty" jsonschema:"oneof_type=string;boolean"`
  1072  	ImageTemplates []string `yaml:"image_templates,omitempty" json:"image_templates,omitempty"`
  1073  	CreateFlags    []string `yaml:"create_flags,omitempty" json:"create_flags,omitempty"`
  1074  	PushFlags      []string `yaml:"push_flags,omitempty" json:"push_flags,omitempty"`
  1075  	Use            string   `yaml:"use,omitempty" json:"use,omitempty"`
  1076  }
  1077  
  1078  // Filters config.
  1079  type Filters struct {
  1080  	Include []string `yaml:"include,omitempty" json:"include,omitempty"`
  1081  	Exclude []string `yaml:"exclude,omitempty" json:"exclude,omitempty"`
  1082  }
  1083  
  1084  // Changelog Config.
  1085  type Changelog struct {
  1086  	Filters Filters          `yaml:"filters,omitempty" json:"filters,omitempty"`
  1087  	Sort    string           `yaml:"sort,omitempty" json:"sort,omitempty" jsonschema:"enum=asc,enum=desc,enum=,default="`
  1088  	Disable string           `yaml:"disable,omitempty" json:"disable,omitempty" jsonschema:"oneof_type=string;boolean"`
  1089  	Use     string           `yaml:"use,omitempty" json:"use,omitempty" jsonschema:"enum=git,enum=github,enum=github-native,enum=gitlab,default=git"`
  1090  	Groups  []ChangelogGroup `yaml:"groups,omitempty" json:"groups,omitempty"`
  1091  	Abbrev  int              `yaml:"abbrev,omitempty" json:"abbrev,omitempty"`
  1092  
  1093  	// Deprecated: use disable instead.
  1094  	Skip string `yaml:"skip,omitempty" json:"skip,omitempty" jsonschema:"oneof_type=string;boolean,deprecated=true,description=use disable instead"`
  1095  }
  1096  
  1097  // ChangelogGroup holds the grouping criteria for the changelog.
  1098  type ChangelogGroup struct {
  1099  	Title  string `yaml:"title,omitempty" json:"title,omitempty"`
  1100  	Regexp string `yaml:"regexp,omitempty" json:"regexp,omitempty"`
  1101  	Order  int    `yaml:"order,omitempty" json:"order,omitempty"`
  1102  }
  1103  
  1104  // EnvFiles holds paths to files that contains environment variables
  1105  // values like the github token for example.
  1106  type EnvFiles struct {
  1107  	GitHubToken string `yaml:"github_token,omitempty" json:"github_token,omitempty"`
  1108  	GitLabToken string `yaml:"gitlab_token,omitempty" json:"gitlab_token,omitempty"`
  1109  	GiteaToken  string `yaml:"gitea_token,omitempty" json:"gitea_token,omitempty"`
  1110  }
  1111  
  1112  // Before config.
  1113  type Before struct {
  1114  	Hooks []string `yaml:"hooks,omitempty" json:"hooks,omitempty"`
  1115  }
  1116  
  1117  // Blob contains config for GO CDK blob.
  1118  type Blob struct {
  1119  	Bucket             string      `yaml:"bucket,omitempty" json:"bucket,omitempty"`
  1120  	Provider           string      `yaml:"provider,omitempty" json:"provider,omitempty"`
  1121  	Region             string      `yaml:"region,omitempty" json:"region,omitempty"`
  1122  	DisableSSL         bool        `yaml:"disable_ssl,omitempty" json:"disable_ssl,omitempty"`
  1123  	Directory          string      `yaml:"directory,omitempty" json:"directory,omitempty"`
  1124  	KMSKey             string      `yaml:"kms_key,omitempty" json:"kms_key,omitempty"`
  1125  	IDs                []string    `yaml:"ids,omitempty" json:"ids,omitempty"`
  1126  	Endpoint           string      `yaml:"endpoint,omitempty" json:"endpoint,omitempty"` // used for minio for example
  1127  	ExtraFiles         []ExtraFile `yaml:"extra_files,omitempty" json:"extra_files,omitempty"`
  1128  	Disable            string      `yaml:"disable,omitempty" json:"disable,omitempty" jsonschema:"oneof_type=string;boolean"`
  1129  	S3ForcePathStyle   *bool       `yaml:"s3_force_path_style,omitempty" json:"s3_force_path_style,omitempty"`
  1130  	ACL                string      `yaml:"acl,omitempty" json:"acl,omitempty"`
  1131  	CacheControl       []string    `yaml:"cache_control,omitempty" json:"cache_control,omitempty"`
  1132  	ContentDisposition string      `yaml:"content_disposition,omitempty" json:"content_disposition,omitempty"`
  1133  	IncludeMeta        bool        `yaml:"include_meta,omitempty" json:"include_meta,omitempty"`
  1134  
  1135  	// Deprecated: use disable_ssl instead
  1136  	OldDisableSSL bool `yaml:"disableSSL,omitempty" json:"disableSSL,omitempty" jsonschema:"deprecated=true,description=use disable_ssl instead"` // nolint:tagliatelle
  1137  
  1138  	// Deprecated: use kms_key instead
  1139  	OldKMSKey string `yaml:"kmskey,omitempty" json:"kmskey,omitempty" jsonschema:"deprecated=true,description=use kms_key instead"`
  1140  
  1141  	// Deprecated: use Directory instead.
  1142  	Folder string `yaml:"folder,omitempty" json:"folder,omitempty" jsonschema:"deprecated=true"`
  1143  }
  1144  
  1145  // Upload configuration.
  1146  type Upload struct {
  1147  	Name               string            `yaml:"name,omitempty" json:"name,omitempty"`
  1148  	IDs                []string          `yaml:"ids,omitempty" json:"ids,omitempty"`
  1149  	Exts               []string          `yaml:"exts,omitempty" json:"exts,omitempty"`
  1150  	Target             string            `yaml:"target,omitempty" json:"target,omitempty"`
  1151  	Username           string            `yaml:"username,omitempty" json:"username,omitempty"`
  1152  	Mode               string            `yaml:"mode,omitempty" json:"mode,omitempty"`
  1153  	Method             string            `yaml:"method,omitempty" json:"method,omitempty"`
  1154  	ChecksumHeader     string            `yaml:"checksum_header,omitempty" json:"checksum_header,omitempty"`
  1155  	ClientX509Cert     string            `yaml:"client_x509_cert,omitempty" json:"client_x509_cert,omitempty"`
  1156  	ClientX509Key      string            `yaml:"client_x509_key,omitempty" json:"client_x509_key,omitempty"`
  1157  	TrustedCerts       string            `yaml:"trusted_certificates,omitempty" json:"trusted_certificates,omitempty"`
  1158  	Checksum           bool              `yaml:"checksum,omitempty" json:"checksum,omitempty"`
  1159  	Signature          bool              `yaml:"signature,omitempty" json:"signature,omitempty"`
  1160  	Meta               bool              `yaml:"meta,omitempty" json:"meta,omitempty"`
  1161  	CustomArtifactName bool              `yaml:"custom_artifact_name,omitempty" json:"custom_artifact_name,omitempty"`
  1162  	CustomHeaders      map[string]string `yaml:"custom_headers,omitempty" json:"custom_headers,omitempty"`
  1163  }
  1164  
  1165  // Publisher configuration.
  1166  type Publisher struct {
  1167  	Name       string      `yaml:"name,omitempty" json:"name,omitempty"`
  1168  	IDs        []string    `yaml:"ids,omitempty" json:"ids,omitempty"`
  1169  	Checksum   bool        `yaml:"checksum,omitempty" json:"checksum,omitempty"`
  1170  	Signature  bool        `yaml:"signature,omitempty" json:"signature,omitempty"`
  1171  	Meta       bool        `yaml:"meta,omitempty" json:"meta,omitempty"`
  1172  	Dir        string      `yaml:"dir,omitempty" json:"dir,omitempty"`
  1173  	Cmd        string      `yaml:"cmd,omitempty" json:"cmd,omitempty"`
  1174  	Env        []string    `yaml:"env,omitempty" json:"env,omitempty"`
  1175  	ExtraFiles []ExtraFile `yaml:"extra_files,omitempty" json:"extra_files,omitempty"`
  1176  	Disable    string      `yaml:"disable,omitempty" json:"disable,omitempty" jsonschema:"oneof_type=string;boolean"`
  1177  }
  1178  
  1179  // Source configuration.
  1180  type Source struct {
  1181  	NameTemplate   string `yaml:"name_template,omitempty" json:"name_template,omitempty"`
  1182  	Format         string `yaml:"format,omitempty" json:"format,omitempty" jsonschema:"enum=tar,enum=tgz,enum=tar.gz,enum=zip,default=tar.gz"`
  1183  	Enabled        bool   `yaml:"enabled,omitempty" json:"enabled,omitempty"`
  1184  	PrefixTemplate string `yaml:"prefix_template,omitempty" json:"prefix_template,omitempty"`
  1185  	Files          []File `yaml:"files,omitempty" json:"files,omitempty"`
  1186  
  1187  	// Deprecated: don't need to set this anymore.
  1188  	RLCP string `yaml:"rlcp,omitempty" json:"rlcp,omitempty" jsonschema:"oneof_type=string;boolean,deprecated=true,description=you can now remove this"`
  1189  }
  1190  
  1191  // Project includes all project configuration.
  1192  type Project struct {
  1193  	Version         int              `yaml:"version,omitempty" json:"version,omitempty" jsonschema:"enum=1,default=1"`
  1194  	ProjectName     string           `yaml:"project_name,omitempty" json:"project_name,omitempty"`
  1195  	Env             []string         `yaml:"env,omitempty" json:"env,omitempty"`
  1196  	Release         Release          `yaml:"release,omitempty" json:"release,omitempty"`
  1197  	Milestones      []Milestone      `yaml:"milestones,omitempty" json:"milestones,omitempty"`
  1198  	Brews           []Homebrew       `yaml:"brews,omitempty" json:"brews,omitempty"`
  1199  	Nix             []Nix            `yaml:"nix,omitempty" json:"nix,omitempty"`
  1200  	Winget          []Winget         `yaml:"winget,omitempty" json:"winget,omitempty"`
  1201  	AURs            []AUR            `yaml:"aurs,omitempty" json:"aurs,omitempty"`
  1202  	Krews           []Krew           `yaml:"krews,omitempty" json:"krews,omitempty"`
  1203  	Kos             []Ko             `yaml:"kos,omitempty" json:"kos,omitempty"`
  1204  	Scoops          []Scoop          `yaml:"scoops,omitempty" json:"scoops,omitempty"`
  1205  	Builds          []Build          `yaml:"builds,omitempty" json:"builds,omitempty"`
  1206  	Archives        []Archive        `yaml:"archives,omitempty" json:"archives,omitempty"`
  1207  	NFPMs           []NFPM           `yaml:"nfpms,omitempty" json:"nfpms,omitempty"`
  1208  	Snapcrafts      []Snapcraft      `yaml:"snapcrafts,omitempty" json:"snapcrafts,omitempty"`
  1209  	Snapshot        Snapshot         `yaml:"snapshot,omitempty" json:"snapshot,omitempty"`
  1210  	Checksum        Checksum         `yaml:"checksum,omitempty" json:"checksum,omitempty"`
  1211  	Dockers         []Docker         `yaml:"dockers,omitempty" json:"dockers,omitempty"`
  1212  	DockerManifests []DockerManifest `yaml:"docker_manifests,omitempty" json:"docker_manifests,omitempty"`
  1213  	Artifactories   []Upload         `yaml:"artifactories,omitempty" json:"artifactories,omitempty"`
  1214  	Uploads         []Upload         `yaml:"uploads,omitempty" json:"uploads,omitempty"`
  1215  	Blobs           []Blob           `yaml:"blobs,omitempty" json:"blobs,omitempty"`
  1216  	Publishers      []Publisher      `yaml:"publishers,omitempty" json:"publishers,omitempty"`
  1217  	Changelog       Changelog        `yaml:"changelog,omitempty" json:"changelog,omitempty"`
  1218  	Dist            string           `yaml:"dist,omitempty" json:"dist,omitempty"`
  1219  	Signs           []Sign           `yaml:"signs,omitempty" json:"signs,omitempty"`
  1220  	DockerSigns     []Sign           `yaml:"docker_signs,omitempty" json:"docker_signs,omitempty"`
  1221  	EnvFiles        EnvFiles         `yaml:"env_files,omitempty" json:"env_files,omitempty"`
  1222  	Before          Before           `yaml:"before,omitempty" json:"before,omitempty"`
  1223  	Source          Source           `yaml:"source,omitempty" json:"source,omitempty"`
  1224  	GoMod           GoMod            `yaml:"gomod,omitempty" json:"gomod,omitempty"`
  1225  	Announce        Announce         `yaml:"announce,omitempty" json:"announce,omitempty"`
  1226  	SBOMs           []SBOM           `yaml:"sboms,omitempty" json:"sboms,omitempty"`
  1227  	Chocolateys     []Chocolatey     `yaml:"chocolateys,omitempty" json:"chocolateys,omitempty"`
  1228  	Git             Git              `yaml:"git,omitempty" json:"git,omitempty"`
  1229  	ReportSizes     bool             `yaml:"report_sizes,omitempty" json:"report_sizes,omitempty"`
  1230  	Metadata        ProjectMetadata  `yaml:"metadata,omitempty" json:"metadata,omitempty"`
  1231  
  1232  	UniversalBinaries []UniversalBinary `yaml:"universal_binaries,omitempty" json:"universal_binaries,omitempty"`
  1233  	UPXs              []UPX             `yaml:"upx,omitempty" json:"upx,omitempty"`
  1234  
  1235  	// force the SCM token to use when multiple are set
  1236  	ForceToken string `yaml:"force_token,omitempty" json:"force_token,omitempty" jsonschema:"enum=github,enum=gitlab,enum=gitea,enum=,default="`
  1237  
  1238  	// should be set if using github enterprise
  1239  	GitHubURLs GitHubURLs `yaml:"github_urls,omitempty" json:"github_urls,omitempty"`
  1240  
  1241  	// should be set if using a private gitlab
  1242  	GitLabURLs GitLabURLs `yaml:"gitlab_urls,omitempty" json:"gitlab_urls,omitempty"`
  1243  
  1244  	// should be set if using Gitea
  1245  	GiteaURLs GiteaURLs `yaml:"gitea_urls,omitempty" json:"gitea_urls,omitempty"`
  1246  
  1247  	// Deprecated: use Scoops instead.
  1248  	Scoop Scoop `yaml:"scoop,omitempty" json:"scoop,omitempty" jsonschema:"deprecated=true,description=use scoops instead"`
  1249  
  1250  	// Deprecated: use Builds instead.
  1251  	SingleBuild Build `yaml:"build,omitempty" json:"build,omitempty" jsonschema:"deprecated=true,description=use builds instead"`
  1252  }
  1253  
  1254  type ProjectMetadata struct {
  1255  	ModTimestamp string `yaml:"mod_timestamp,omitempty" json:"mod_timestamp,omitempty"`
  1256  }
  1257  
  1258  type GoMod struct {
  1259  	Proxy    bool     `yaml:"proxy,omitempty" json:"proxy,omitempty"`
  1260  	Env      []string `yaml:"env,omitempty" json:"env,omitempty"`
  1261  	GoBinary string   `yaml:"gobinary,omitempty" json:"gobinary,omitempty"`
  1262  	Mod      string   `yaml:"mod,omitempty" json:"mod,omitempty"`
  1263  	Dir      string   `yaml:"dir,omitempty" json:"dir,omitempty"`
  1264  }
  1265  
  1266  type Announce struct {
  1267  	Skip           string         `yaml:"skip,omitempty" json:"skip,omitempty" jsonschema:"oneof_type=string;boolean"`
  1268  	Twitter        Twitter        `yaml:"twitter,omitempty" json:"twitter,omitempty"`
  1269  	Mastodon       Mastodon       `yaml:"mastodon,omitempty" json:"mastodon,omitempty"`
  1270  	Reddit         Reddit         `yaml:"reddit,omitempty" json:"reddit,omitempty"`
  1271  	Slack          Slack          `yaml:"slack,omitempty" json:"slack,omitempty"`
  1272  	Discord        Discord        `yaml:"discord,omitempty" json:"discord,omitempty"`
  1273  	Teams          Teams          `yaml:"teams,omitempty" json:"teams,omitempty"`
  1274  	SMTP           SMTP           `yaml:"smtp,omitempty" json:"smtp,omitempty"`
  1275  	Mattermost     Mattermost     `yaml:"mattermost,omitempty" json:"mattermost,omitempty"`
  1276  	LinkedIn       LinkedIn       `yaml:"linkedin,omitempty" json:"linkedin,omitempty"`
  1277  	Telegram       Telegram       `yaml:"telegram,omitempty" json:"telegram,omitempty"`
  1278  	Webhook        Webhook        `yaml:"webhook,omitempty" json:"webhook,omitempty"`
  1279  	OpenCollective OpenCollective `yaml:"opencollective,omitempty" json:"opencolletive,omitempty"`
  1280  }
  1281  
  1282  type Webhook struct {
  1283  	Enabled         bool              `yaml:"enabled,omitempty" json:"enabled,omitempty"`
  1284  	SkipTLSVerify   bool              `yaml:"skip_tls_verify,omitempty" json:"skip_tls_verify,omitempty"`
  1285  	MessageTemplate string            `yaml:"message_template,omitempty" json:"message_template,omitempty"`
  1286  	EndpointURL     string            `yaml:"endpoint_url,omitempty" json:"endpoint_url,omitempty"`
  1287  	Headers         map[string]string `yaml:"headers,omitempty" json:"headers,omitempty"`
  1288  	ContentType     string            `yaml:"content_type,omitempty" json:"content_type,omitempty"`
  1289  }
  1290  
  1291  type Twitter struct {
  1292  	Enabled         bool   `yaml:"enabled,omitempty" json:"enabled,omitempty"`
  1293  	MessageTemplate string `yaml:"message_template,omitempty" json:"message_template,omitempty"`
  1294  }
  1295  
  1296  type Mastodon struct {
  1297  	Enabled         bool   `yaml:"enabled,omitempty" json:"enabled,omitempty"`
  1298  	MessageTemplate string `yaml:"message_template,omitempty" json:"message_template,omitempty"`
  1299  	Server          string `yaml:"server" json:"server"`
  1300  }
  1301  
  1302  type Reddit struct {
  1303  	Enabled       bool   `yaml:"enabled,omitempty" json:"enabled,omitempty"`
  1304  	ApplicationID string `yaml:"application_id,omitempty" json:"application_id,omitempty"`
  1305  	Username      string `yaml:"username,omitempty" json:"username,omitempty"`
  1306  	TitleTemplate string `yaml:"title_template,omitempty" json:"title_template,omitempty"`
  1307  	URLTemplate   string `yaml:"url_template,omitempty" json:"url_template,omitempty"`
  1308  	Sub           string `yaml:"sub,omitempty" json:"sub,omitempty"`
  1309  }
  1310  
  1311  type Slack struct {
  1312  	Enabled         bool              `yaml:"enabled,omitempty" json:"enabled,omitempty"`
  1313  	MessageTemplate string            `yaml:"message_template,omitempty" json:"message_template,omitempty"`
  1314  	Channel         string            `yaml:"channel,omitempty" json:"channel,omitempty"`
  1315  	Username        string            `yaml:"username,omitempty" json:"username,omitempty"`
  1316  	IconEmoji       string            `yaml:"icon_emoji,omitempty" json:"icon_emoji,omitempty"`
  1317  	IconURL         string            `yaml:"icon_url,omitempty" json:"icon_url,omitempty"`
  1318  	Blocks          []SlackBlock      `yaml:"blocks,omitempty" json:"blocks,omitempty"`
  1319  	Attachments     []SlackAttachment `yaml:"attachments,omitempty" json:"attachments,omitempty"`
  1320  }
  1321  
  1322  type Discord struct {
  1323  	Enabled         bool   `yaml:"enabled,omitempty" json:"enabled,omitempty"`
  1324  	MessageTemplate string `yaml:"message_template,omitempty" json:"message_template,omitempty"`
  1325  	Author          string `yaml:"author,omitempty" json:"author,omitempty"`
  1326  	Color           string `yaml:"color,omitempty" json:"color,omitempty"`
  1327  	IconURL         string `yaml:"icon_url,omitempty" json:"icon_url,omitempty"`
  1328  }
  1329  
  1330  type Teams struct {
  1331  	Enabled         bool   `yaml:"enabled,omitempty" json:"enabled,omitempty"`
  1332  	TitleTemplate   string `yaml:"title_template,omitempty" json:"title_template,omitempty"`
  1333  	MessageTemplate string `yaml:"message_template,omitempty" json:"message_template,omitempty"`
  1334  	Color           string `yaml:"color,omitempty" json:"color,omitempty"`
  1335  	IconURL         string `yaml:"icon_url,omitempty" json:"icon_url,omitempty"`
  1336  }
  1337  
  1338  type Mattermost struct {
  1339  	Enabled         bool   `yaml:"enabled,omitempty" json:"enabled,omitempty"`
  1340  	MessageTemplate string `yaml:"message_template,omitempty" json:"message_template,omitempty"`
  1341  	TitleTemplate   string `yaml:"title_template,omitempty" json:"title_template,omitempty"`
  1342  	Color           string `yaml:"color,omitempty" json:"color,omitempty"`
  1343  	Channel         string `yaml:"channel,omitempty" json:"channel,omitempty"`
  1344  	Username        string `yaml:"username,omitempty" json:"username,omitempty"`
  1345  	IconEmoji       string `yaml:"icon_emoji,omitempty" json:"icon_emoji,omitempty"`
  1346  	IconURL         string `yaml:"icon_url,omitempty" json:"icon_url,omitempty"`
  1347  }
  1348  
  1349  type SMTP struct {
  1350  	Enabled            bool     `yaml:"enabled,omitempty" json:"enabled,omitempty"`
  1351  	Host               string   `yaml:"host,omitempty" json:"host,omitempty"`
  1352  	Port               int      `yaml:"port,omitempty" json:"port,omitempty"`
  1353  	Username           string   `yaml:"username,omitempty" json:"username,omitempty"`
  1354  	From               string   `yaml:"from,omitempty" json:"from,omitempty"`
  1355  	To                 []string `yaml:"to,omitempty" json:"to,omitempty"`
  1356  	SubjectTemplate    string   `yaml:"subject_template,omitempty" json:"subject_template,omitempty"`
  1357  	BodyTemplate       string   `yaml:"body_template,omitempty" json:"body_template,omitempty"`
  1358  	InsecureSkipVerify bool     `yaml:"insecure_skip_verify,omitempty" json:"insecure_skip_verify,omitempty"`
  1359  }
  1360  
  1361  type LinkedIn struct {
  1362  	Enabled         bool   `yaml:"enabled,omitempty" json:"enabled,omitempty"`
  1363  	MessageTemplate string `yaml:"message_template,omitempty" json:"message_template,omitempty"`
  1364  }
  1365  
  1366  type Telegram struct {
  1367  	Enabled         bool   `yaml:"enabled,omitempty" json:"enabled,omitempty"`
  1368  	MessageTemplate string `yaml:"message_template,omitempty" json:"message_template,omitempty"`
  1369  	ChatID          string `yaml:"chat_id,omitempty" json:"chat_id,omitempty" jsonschema:"oneof_type=string;integer"`
  1370  	ParseMode       string `yaml:"parse_mode,omitempty" json:"parse_mode,omitempty" jsonschema:"enum=MarkdownV2,enum=HTML,default=MarkdownV2"`
  1371  }
  1372  
  1373  type OpenCollective struct {
  1374  	Enabled         bool   `yaml:"enabled,omitempty" json:"enabled,omitempty"`
  1375  	Slug            string `yaml:"slug,omitempty" json:"slug,omitempty"`
  1376  	TitleTemplate   string `yaml:"title_template,omitempty" json:"title_template,omitempty"`
  1377  	MessageTemplate string `yaml:"message_template,omitempty" json:"message_template,omitempty"`
  1378  }
  1379  
  1380  // SlackBlock represents the untyped structure of a rich slack message layout.
  1381  type SlackBlock struct {
  1382  	Internal interface{}
  1383  }
  1384  
  1385  // UnmarshalYAML is a custom unmarshaler that unmarshals a YAML slack block as untyped interface{}.
  1386  func (a *SlackBlock) UnmarshalYAML(unmarshal func(interface{}) error) error {
  1387  	var yamlv2 interface{}
  1388  	if err := unmarshal(&yamlv2); err != nil {
  1389  		return err
  1390  	}
  1391  
  1392  	a.Internal = yamlv2
  1393  
  1394  	return nil
  1395  }
  1396  
  1397  // MarshalJSON marshals a slack block as JSON.
  1398  func (a SlackBlock) MarshalJSON() ([]byte, error) {
  1399  	return json.Marshal(a.Internal)
  1400  }
  1401  
  1402  // SlackAttachment represents the untyped structure of a slack message attachment.
  1403  type SlackAttachment struct {
  1404  	Internal interface{}
  1405  }
  1406  
  1407  // UnmarshalYAML is a custom unmarshaler that unmarshals a YAML slack attachment as untyped interface{}.
  1408  func (a *SlackAttachment) UnmarshalYAML(unmarshal func(interface{}) error) error {
  1409  	var yamlv2 interface{}
  1410  	if err := unmarshal(&yamlv2); err != nil {
  1411  		return err
  1412  	}
  1413  
  1414  	a.Internal = yamlv2
  1415  
  1416  	return nil
  1417  }
  1418  
  1419  // MarshalJSON marshals a slack attachment as JSON.
  1420  func (a SlackAttachment) MarshalJSON() ([]byte, error) {
  1421  	return json.Marshal(a.Internal)
  1422  }
  1423  
  1424  // Chocolatey contains the chocolatey section.
  1425  type Chocolatey struct {
  1426  	Name                     string                 `yaml:"name,omitempty" json:"name,omitempty"`
  1427  	IDs                      []string               `yaml:"ids,omitempty" json:"ids,omitempty"`
  1428  	PackageSourceURL         string                 `yaml:"package_source_url,omitempty" json:"package_source_url,omitempty"`
  1429  	Owners                   string                 `yaml:"owners,omitempty" json:"owners,omitempty"`
  1430  	Title                    string                 `yaml:"title,omitempty" json:"title,omitempty"`
  1431  	Authors                  string                 `yaml:"authors,omitempty" json:"authors,omitempty"`
  1432  	ProjectURL               string                 `yaml:"project_url,omitempty" json:"project_url,omitempty"`
  1433  	URLTemplate              string                 `yaml:"url_template,omitempty" json:"url_template,omitempty"`
  1434  	IconURL                  string                 `yaml:"icon_url,omitempty" json:"icon_url,omitempty"`
  1435  	Copyright                string                 `yaml:"copyright,omitempty" json:"copyright,omitempty"`
  1436  	LicenseURL               string                 `yaml:"license_url,omitempty" json:"license_url,omitempty"`
  1437  	RequireLicenseAcceptance bool                   `yaml:"require_license_acceptance,omitempty" json:"require_license_acceptance,omitempty"`
  1438  	ProjectSourceURL         string                 `yaml:"project_source_url,omitempty" json:"project_source_url,omitempty"`
  1439  	DocsURL                  string                 `yaml:"docs_url,omitempty" json:"docs_url,omitempty"`
  1440  	BugTrackerURL            string                 `yaml:"bug_tracker_url,omitempty" json:"bug_tracker_url,omitempty"`
  1441  	Tags                     string                 `yaml:"tags,omitempty" json:"tags,omitempty"`
  1442  	Summary                  string                 `yaml:"summary,omitempty" json:"summary,omitempty"`
  1443  	Description              string                 `yaml:"description,omitempty" json:"description,omitempty"`
  1444  	ReleaseNotes             string                 `yaml:"release_notes,omitempty" json:"release_notes,omitempty"`
  1445  	Dependencies             []ChocolateyDependency `yaml:"dependencies,omitempty" json:"dependencies,omitempty"`
  1446  	SkipPublish              bool                   `yaml:"skip_publish,omitempty" json:"skip_publish,omitempty"`
  1447  	APIKey                   string                 `yaml:"api_key,omitempty" json:"api_key,omitempty"`
  1448  	SourceRepo               string                 `yaml:"source_repo,omitempty" json:"source_repo,omitempty"`
  1449  	Goamd64                  string                 `yaml:"goamd64,omitempty" json:"goamd64,omitempty"`
  1450  }
  1451  
  1452  // ChcolateyDependency represents Chocolatey dependency.
  1453  type ChocolateyDependency struct {
  1454  	ID      string `yaml:"id,omitempty" json:"id,omitempty"`
  1455  	Version string `yaml:"version,omitempty" json:"version,omitempty"`
  1456  }