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 (
2022-03-30 14:42:59 +02:00
"encoding/json"
2022-05-09 09:32:43 -03:00
"fmt"
2017-05-10 19:14:17 -07:00
"io"
2017-05-18 09:02:02 -03:00
"os"
2018-05-14 17:22:55 -07:00
"strings"
2021-07-21 22:09:02 -03:00
"time"
2017-07-08 12:05:57 -03:00
2022-06-21 21:11:15 -03:00
"github.com/caarlos0/log"
2022-03-29 19:00:53 +02:00
"github.com/goreleaser/goreleaser/internal/yaml"
2020-12-23 23:07:48 -03:00
"github.com/goreleaser/nfpm/v2/files"
2022-06-12 22:31:30 -03:00
"github.com/invopop/jsonschema"
2016-12-21 10:35:34 -02:00
)
2022-12-02 21:50:04 -03:00
// Git configs.
type Git struct {
2023-03-20 02:19:40 +01:00
TagSort string ` yaml:"tag_sort,omitempty" json:"tag_sort,omitempty" `
PrereleaseSuffix string ` yaml:"prerelease_suffix,omitempty" json:"prerelease_suffix,omitempty" `
2022-12-02 21:50:04 -03:00
}
2020-05-26 00:48:10 -03:00
// GitHubURLs holds the URLs to be used when using github enterprise.
2017-09-26 18:33:22 -03:00
type GitHubURLs struct {
2022-08-04 15:30:25 -03:00
API string ` yaml:"api,omitempty" json:"api,omitempty" `
Upload string ` yaml:"upload,omitempty" json:"upload,omitempty" `
Download string ` yaml:"download,omitempty" json:"download,omitempty" `
SkipTLSVerify bool ` yaml:"skip_tls_verify,omitempty" json:"skip_tls_verify,omitempty" `
2017-09-26 18:33:22 -03:00
}
2020-05-26 00:48:10 -03:00
// GitLabURLs holds the URLs to be used when using gitlab ce/enterprise.
2019-06-29 16:02:40 +02:00
type GitLabURLs struct {
2022-08-04 15:30:25 -03:00
API string ` yaml:"api,omitempty" json:"api,omitempty" `
Download string ` yaml:"download,omitempty" json:"download,omitempty" `
SkipTLSVerify bool ` yaml:"skip_tls_verify,omitempty" json:"skip_tls_verify,omitempty" `
UsePackageRegistry bool ` yaml:"use_package_registry,omitempty" json:"use_package_registry,omitempty" `
2022-08-16 00:39:13 -03:00
UseJobToken bool ` yaml:"use_job_token,omitempty" json:"use_job_token,omitempty" `
2019-06-29 16:02:40 +02:00
}
2020-05-26 00:48:10 -03:00
// GiteaURLs holds the URLs to be used when using gitea.
2019-08-26 10:31:38 +03:00
type GiteaURLs struct {
2022-08-04 15:30:25 -03:00
API string ` yaml:"api,omitempty" json:"api,omitempty" `
Download string ` yaml:"download,omitempty" json:"download,omitempty" `
SkipTLSVerify bool ` yaml:"skip_tls_verify,omitempty" json:"skip_tls_verify,omitempty" `
2019-08-26 10:31:38 +03:00
}
2020-05-26 00:48:10 -03:00
// Repo represents any kind of repo (github, gitlab, etc).
2020-07-06 21:12:41 +01:00
// to upload releases into.
2017-03-22 21:01:29 -03:00
type Repo struct {
2022-08-04 15:30:25 -03:00
Owner string ` yaml:"owner,omitempty" json:"owner,omitempty" `
Name string ` yaml:"name,omitempty" json:"name,omitempty" `
RawURL string ` yaml:"-" json:"-" `
2017-03-22 21:01:29 -03:00
}
2021-11-01 09:31:43 -03:00
// String of the repo, e.g. owner/name.
func ( r Repo ) String ( ) string {
2022-05-09 09:32:43 -03:00
if r . isSCM ( ) {
return r . Owner + "/" + r . Name
2021-11-01 09:31:43 -03:00
}
2022-05-09 09:32:43 -03:00
return r . Owner
}
// CheckSCM returns an error if the given url is not a valid scm url.
func ( r Repo ) CheckSCM ( ) error {
if r . isSCM ( ) {
return nil
}
return fmt . Errorf ( "invalid scm url: %s" , r . RawURL )
}
// isSCM returns true if the repo has both an owner and name.
func ( r Repo ) isSCM ( ) bool {
return r . Owner != "" && r . Name != ""
2021-11-01 09:31:43 -03:00
}
2020-07-06 21:12:41 +01:00
// RepoRef represents any kind of repo which may differ
// from the one we are building from and may therefore
// also require separate authentication
// e.g. Homebrew Tap, Scoop bucket.
type RepoRef struct {
2022-08-04 15:30:25 -03:00
Owner string ` yaml:"owner,omitempty" json:"owner,omitempty" `
Name string ` yaml:"name,omitempty" json:"name,omitempty" `
Token string ` yaml:"token,omitempty" json:"token,omitempty" `
Branch string ` yaml:"branch,omitempty" json:"branch,omitempty" `
2023-04-06 22:58:06 -03:00
PullRequest PullRequest ` yaml:"pull_request,omitempty" json:"pull_request,omitempty" `
}
type PullRequest struct {
Enabled bool ` yaml:"enabled,omitempty" json:"enabled,omitempty" `
Base string ` yaml:"base,omitempty" json:"base,omitempty" `
2020-07-06 21:12:41 +01:00
}
2020-05-26 00:48:10 -03:00
// HomebrewDependency represents Homebrew dependency.
2020-05-24 18:10:25 +03:00
type HomebrewDependency struct {
2022-08-17 22:58:41 -03:00
Name string ` yaml:"name,omitempty" json:"name,omitempty" `
Type string ` yaml:"type,omitempty" json:"type,omitempty" `
Version string ` yaml:"version,omitempty" json:"version,omitempty" `
2020-05-24 18:10:25 +03:00
}
2020-05-26 00:48:10 -03:00
// type alias to prevent stack overflowing in the custom unmarshaler.
2020-05-25 06:40:27 -03:00
type homebrewDependency HomebrewDependency
// UnmarshalYAML is a custom unmarshaler that accept brew deps in both the old and new format.
func ( a * HomebrewDependency ) UnmarshalYAML ( unmarshal func ( interface { } ) error ) error {
var str string
if err := unmarshal ( & str ) ; err == nil {
a . Name = str
return nil
}
var dep homebrewDependency
if err := unmarshal ( & dep ) ; err != nil {
return err
}
a . Name = dep . Name
a . Type = dep . Type
return nil
}
2022-06-12 22:31:30 -03:00
func ( a HomebrewDependency ) JSONSchema ( ) * jsonschema . Schema {
2021-10-26 20:02:03 +02:00
reflector := jsonschema . Reflector {
ExpandedStruct : true ,
}
schema := reflector . Reflect ( & homebrewDependency { } )
2022-06-12 22:31:30 -03:00
return & jsonschema . Schema {
OneOf : [ ] * jsonschema . Schema {
2021-10-26 20:02:03 +02:00
{
Type : "string" ,
} ,
2022-06-12 22:31:30 -03:00
schema ,
2021-10-26 20:02:03 +02:00
} ,
}
}
2022-01-20 14:59:39 -03:00
type AUR struct {
2022-08-04 15:30:25 -03:00
Name string ` yaml:"name,omitempty" json:"name,omitempty" `
IDs [ ] string ` yaml:"ids,omitempty" json:"ids,omitempty" `
CommitAuthor CommitAuthor ` yaml:"commit_author,omitempty" json:"commit_author,omitempty" `
CommitMessageTemplate string ` yaml:"commit_msg_template,omitempty" json:"commit_msg_template,omitempty" `
Description string ` yaml:"description,omitempty" json:"description,omitempty" `
Homepage string ` yaml:"homepage,omitempty" json:"homepage,omitempty" `
License string ` yaml:"license,omitempty" json:"license,omitempty" `
2022-11-14 15:01:24 -03:00
SkipUpload string ` yaml:"skip_upload,omitempty" json:"skip_upload,omitempty" jsonschema:"oneof_type=string;boolean" `
2022-08-04 15:30:25 -03:00
URLTemplate string ` yaml:"url_template,omitempty" json:"url_template,omitempty" `
Maintainers [ ] string ` yaml:"maintainers,omitempty" json:"maintainers,omitempty" `
Contributors [ ] string ` yaml:"contributors,omitempty" json:"contributors,omitempty" `
Provides [ ] string ` yaml:"provides,omitempty" json:"provides,omitempty" `
Conflicts [ ] string ` yaml:"conflicts,omitempty" json:"conflicts,omitempty" `
Depends [ ] string ` yaml:"depends,omitempty" json:"depends,omitempty" `
OptDepends [ ] string ` yaml:"optdepends,omitempty" json:"optdepends,omitempty" `
2022-10-05 09:42:17 -03:00
Backup [ ] string ` yaml:"backup,omitempty" json:"backup,omitempty" `
2022-08-04 15:30:25 -03:00
Rel string ` yaml:"rel,omitempty" json:"rel,omitempty" `
Package string ` yaml:"package,omitempty" json:"package,omitempty" `
GitURL string ` yaml:"git_url,omitempty" json:"git_url,omitempty" `
GitSSHCommand string ` yaml:"git_ssh_command,omitempty" json:"git_ssh_command,omitempty" `
PrivateKey string ` yaml:"private_key,omitempty" json:"private_key,omitempty" `
Goamd64 string ` yaml:"goamd64,omitempty" json:"goamd64,omitempty" `
2022-01-20 14:59:39 -03:00
}
2020-05-26 00:48:10 -03:00
// Homebrew contains the brew section.
2017-01-15 14:37:00 -02:00
type Homebrew struct {
2022-08-04 15:30:25 -03:00
Name string ` yaml:"name,omitempty" json:"name,omitempty" `
Tap RepoRef ` yaml:"tap,omitempty" json:"tap,omitempty" `
CommitAuthor CommitAuthor ` yaml:"commit_author,omitempty" json:"commit_author,omitempty" `
CommitMessageTemplate string ` yaml:"commit_msg_template,omitempty" json:"commit_msg_template,omitempty" `
Folder string ` yaml:"folder,omitempty" json:"folder,omitempty" `
Caveats string ` yaml:"caveats,omitempty" json:"caveats,omitempty" `
Plist string ` yaml:"plist,omitempty" json:"plist,omitempty" `
Install string ` yaml:"install,omitempty" json:"install,omitempty" `
PostInstall string ` yaml:"post_install,omitempty" json:"post_install,omitempty" `
Dependencies [ ] HomebrewDependency ` yaml:"dependencies,omitempty" json:"dependencies,omitempty" `
Test string ` yaml:"test,omitempty" json:"test,omitempty" `
Conflicts [ ] string ` yaml:"conflicts,omitempty" json:"conflicts,omitempty" `
Description string ` yaml:"description,omitempty" json:"description,omitempty" `
Homepage string ` yaml:"homepage,omitempty" json:"homepage,omitempty" `
License string ` yaml:"license,omitempty" json:"license,omitempty" `
2022-11-14 15:01:24 -03:00
SkipUpload string ` yaml:"skip_upload,omitempty" json:"skip_upload,omitempty" jsonschema:"oneof_type=string;boolean" `
2022-08-04 15:30:25 -03:00
DownloadStrategy string ` yaml:"download_strategy,omitempty" json:"download_strategy,omitempty" `
URLTemplate string ` yaml:"url_template,omitempty" json:"url_template,omitempty" `
CustomRequire string ` yaml:"custom_require,omitempty" json:"custom_require,omitempty" `
CustomBlock string ` yaml:"custom_block,omitempty" json:"custom_block,omitempty" `
IDs [ ] string ` yaml:"ids,omitempty" json:"ids,omitempty" `
2022-11-14 15:01:24 -03:00
Goarm string ` yaml:"goarm,omitempty" json:"goarm,omitempty" jsonschema:"oneof_type=string;integer" `
2022-08-04 15:30:25 -03:00
Goamd64 string ` yaml:"goamd64,omitempty" json:"goamd64,omitempty" `
Service string ` yaml:"service,omitempty" json:"service,omitempty" `
2016-12-21 10:35:34 -02:00
}
2021-11-11 09:37:58 -03:00
// Krew contains the krew section.
type Krew struct {
2022-08-04 15:30:25 -03:00
IDs [ ] string ` yaml:"ids,omitempty" json:"ids,omitempty" `
Name string ` yaml:"name,omitempty" json:"name,omitempty" `
Index RepoRef ` yaml:"index,omitempty" json:"index,omitempty" `
CommitAuthor CommitAuthor ` yaml:"commit_author,omitempty" json:"commit_author,omitempty" `
CommitMessageTemplate string ` yaml:"commit_msg_template,omitempty" json:"commit_msg_template,omitempty" `
Caveats string ` yaml:"caveats,omitempty" json:"caveats,omitempty" `
ShortDescription string ` yaml:"short_description,omitempty" json:"short_description,omitempty" `
Description string ` yaml:"description,omitempty" json:"description,omitempty" `
Homepage string ` yaml:"homepage,omitempty" json:"homepage,omitempty" `
URLTemplate string ` yaml:"url_template,omitempty" json:"url_template,omitempty" `
2022-11-14 15:01:24 -03:00
Goarm string ` yaml:"goarm,omitempty" json:"goarm,omitempty" jsonschema:"oneof_type=string;integer" `
2022-08-04 15:30:25 -03:00
Goamd64 string ` yaml:"goamd64,omitempty" json:"goamd64,omitempty" `
2022-11-14 15:01:24 -03:00
SkipUpload string ` yaml:"skip_upload,omitempty" json:"skip_upload,omitempty" jsonschema:"oneof_type=string;boolean" `
2021-11-11 09:37:58 -03:00
}
2023-01-16 22:34:49 -03:00
// Ko contains the ko section
type Ko struct {
2023-03-20 12:05:44 -07:00
ID string ` yaml:"id,omitempty" json:"id,omitempty" `
Build string ` yaml:"build,omitempty" json:"build,omitempty" `
Main string ` yaml:"main,omitempty" json:"main,omitempty" `
WorkingDir string ` yaml:"working_dir,omitempty" json:"working_dir,omitempty" `
BaseImage string ` yaml:"base_image,omitempty" json:"base_image,omitempty" `
Labels map [ string ] string ` yaml:"labels,omitempty" json:"labels,omitempty" `
Repository string ` yaml:"repository,omitempty" json:"repository,omitempty" `
Platforms [ ] string ` yaml:"platforms,omitempty" json:"platforms,omitempty" `
Tags [ ] string ` yaml:"tags,omitempty" json:"tags,omitempty" `
CreationTime string ` yaml:"creation_time,omitempty" json:"creation_time,omitempty" `
KoDataCreationTime string ` yaml:"ko_data_creation_time,omitempty" json:"ko_data_creation_time,omitempty" `
SBOM string ` yaml:"sbom,omitempty" json:"sbom,omitempty" `
Ldflags [ ] string ` yaml:"ldflags,omitempty" json:"ldflags,omitempty" `
Flags [ ] string ` yaml:"flags,omitempty" json:"flags,omitempty" `
Env [ ] string ` yaml:"env,omitempty" json:"env,omitempty" `
Bare bool ` yaml:"bare,omitempty" json:"bare,omitempty" `
PreserveImportPaths bool ` yaml:"preserve_import_paths,omitempty" json:"preserve_import_paths,omitempty" `
BaseImportPaths bool ` yaml:"base_import_paths,omitempty" json:"base_import_paths,omitempty" `
2023-01-16 22:34:49 -03:00
}
2020-05-26 00:48:10 -03:00
// Scoop contains the scoop.sh section.
2018-02-10 12:38:07 +00:00
type Scoop struct {
2022-08-04 15:30:25 -03:00
Name string ` yaml:"name,omitempty" json:"name,omitempty" `
Bucket RepoRef ` yaml:"bucket,omitempty" json:"bucket,omitempty" `
Folder string ` yaml:"folder,omitempty" json:"folder,omitempty" `
CommitAuthor CommitAuthor ` yaml:"commit_author,omitempty" json:"commit_author,omitempty" `
CommitMessageTemplate string ` yaml:"commit_msg_template,omitempty" json:"commit_msg_template,omitempty" `
Homepage string ` yaml:"homepage,omitempty" json:"homepage,omitempty" `
Description string ` yaml:"description,omitempty" json:"description,omitempty" `
License string ` yaml:"license,omitempty" json:"license,omitempty" `
URLTemplate string ` yaml:"url_template,omitempty" json:"url_template,omitempty" `
Persist [ ] string ` yaml:"persist,omitempty" json:"persist,omitempty" `
2022-11-14 15:01:24 -03:00
SkipUpload string ` yaml:"skip_upload,omitempty" json:"skip_upload,omitempty" jsonschema:"oneof_type=string;boolean" `
2022-08-04 15:30:25 -03:00
PreInstall [ ] string ` yaml:"pre_install,omitempty" json:"pre_install,omitempty" `
PostInstall [ ] string ` yaml:"post_install,omitempty" json:"post_install,omitempty" `
2023-02-22 09:18:44 -03:00
Depends [ ] string ` yaml:"depends,omitempty" json:"depends,omitempty" `
2023-03-20 20:21:44 +08:00
Shortcuts [ ] [ ] string ` yaml:"shortcuts,omitempty" json:"shortcuts,omitempty" `
2022-08-04 15:30:25 -03:00
Goamd64 string ` yaml:"goamd64,omitempty" json:"goamd64,omitempty" `
2018-02-10 12:38:07 +00:00
}
2020-05-26 00:48:10 -03:00
// CommitAuthor is the author of a Git commit.
2017-09-30 20:37:03 +02:00
type CommitAuthor struct {
2022-08-04 15:30:25 -03:00
Name string ` yaml:"name,omitempty" json:"name,omitempty" `
Email string ` yaml:"email,omitempty" json:"email,omitempty" `
2017-09-30 20:37:03 +02:00
}
2021-11-01 09:31:43 -03:00
// BuildHooks define actions to run before and/or after something.
type BuildHooks struct { // renamed on pro
2022-08-04 15:30:25 -03:00
Pre string ` yaml:"pre,omitempty" json:"pre,omitempty" `
Post string ` yaml:"post,omitempty" json:"post,omitempty" `
2017-01-21 20:02:51 -02:00
}
2020-05-26 00:48:10 -03:00
// IgnoredBuild represents a build ignored by the user.
2017-04-26 20:08:25 -03:00
type IgnoredBuild struct {
2022-08-04 15:30:25 -03:00
Goos string ` yaml:"goos,omitempty" json:"goos,omitempty" `
Goarch string ` yaml:"goarch,omitempty" json:"goarch,omitempty" `
2022-11-14 15:01:24 -03:00
Goarm string ` yaml:"goarm,omitempty" json:"goarm,omitempty" jsonschema:"oneof_type=string;integer" `
2022-08-04 15:30:25 -03:00
Gomips string ` yaml:"gomips,omitempty" json:"gomips,omitempty" `
Goamd64 string ` yaml:"goamd64,omitempty" json:"goamd64,omitempty" `
2017-04-26 20:08:25 -03:00
}
2020-05-26 00:48:10 -03:00
// StringArray is a wrapper for an array of strings.
2018-05-14 17:22:55 -07:00
type StringArray [ ] string
2020-05-26 00:48:10 -03:00
// UnmarshalYAML is a custom unmarshaler that wraps strings in arrays.
2018-05-14 17:22:55 -07:00
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
}
2022-06-12 22:31:30 -03:00
func ( a StringArray ) JSONSchema ( ) * jsonschema . Schema {
return & jsonschema . Schema {
OneOf : [ ] * jsonschema . Schema { {
2021-10-26 20:02:03 +02:00
Type : "string" ,
} , {
Type : "array" ,
2022-06-12 22:31:30 -03:00
Items : & jsonschema . Schema {
2021-10-26 20:02:03 +02:00
Type : "string" ,
} ,
} } ,
}
}
2020-05-26 00:48:10 -03:00
// FlagArray is a wrapper for an array of strings.
2018-05-14 17:22:55 -07:00
type FlagArray [ ] string
2020-05-26 00:48:10 -03:00
// UnmarshalYAML is a custom unmarshaler that wraps strings in arrays.
2018-05-14 17:22:55 -07:00
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
}
2022-06-12 22:31:30 -03:00
func ( a FlagArray ) JSONSchema ( ) * jsonschema . Schema {
return & jsonschema . Schema {
OneOf : [ ] * jsonschema . Schema { {
2021-10-26 20:02:03 +02:00
Type : "string" ,
} , {
Type : "array" ,
2022-06-12 22:31:30 -03:00
Items : & jsonschema . Schema {
2021-10-26 20:02:03 +02:00
Type : "string" ,
} ,
} } ,
}
}
2020-05-26 00:48:10 -03:00
// Build contains the build configuration section.
2017-01-15 14:37:00 -02:00
type Build struct {
2022-08-04 15:30:25 -03:00
ID string ` yaml:"id,omitempty" json:"id,omitempty" `
Goos [ ] string ` yaml:"goos,omitempty" json:"goos,omitempty" `
Goarch [ ] string ` yaml:"goarch,omitempty" json:"goarch,omitempty" `
Goarm [ ] string ` yaml:"goarm,omitempty" json:"goarm,omitempty" `
Gomips [ ] string ` yaml:"gomips,omitempty" json:"gomips,omitempty" `
Goamd64 [ ] string ` yaml:"goamd64,omitempty" json:"goamd64,omitempty" `
Targets [ ] string ` yaml:"targets,omitempty" json:"targets,omitempty" `
Ignore [ ] IgnoredBuild ` yaml:"ignore,omitempty" json:"ignore,omitempty" `
Dir string ` yaml:"dir,omitempty" json:"dir,omitempty" `
Main string ` yaml:"main,omitempty" json:"main,omitempty" `
Binary string ` yaml:"binary,omitempty" json:"binary,omitempty" `
Hooks BuildHookConfig ` yaml:"hooks,omitempty" json:"hooks,omitempty" `
Builder string ` yaml:"builder,omitempty" json:"builder,omitempty" `
ModTimestamp string ` yaml:"mod_timestamp,omitempty" json:"mod_timestamp,omitempty" `
2023-01-07 17:10:46 -03:00
Skip bool ` yaml:"skip,omitempty" json:"skip,omitempty" `
2022-08-04 15:30:25 -03:00
GoBinary string ` yaml:"gobinary,omitempty" json:"gobinary,omitempty" `
Command string ` yaml:"command,omitempty" json:"command,omitempty" `
NoUniqueDistDir bool ` yaml:"no_unique_dist_dir,omitempty" json:"no_unique_dist_dir,omitempty" `
NoMainCheck bool ` yaml:"no_main_check,omitempty" json:"no_main_check,omitempty" `
UnproxiedMain string ` yaml:"-" json:"-" ` // used by gomod.proxy
UnproxiedDir string ` yaml:"-" json:"-" ` // used by gomod.proxy
BuildDetails ` yaml:",inline" json:",inline" ` // nolint: tagliatelle
BuildDetailsOverrides [ ] BuildDetailsOverride ` yaml:"overrides,omitempty" json:"overrides,omitempty" `
2022-02-02 00:01:34 -03:00
}
type BuildDetailsOverride struct {
2022-08-04 15:30:25 -03:00
Goos string ` yaml:"goos,omitempty" json:"goos,omitempty" `
Goarch string ` yaml:"goarch,omitempty" json:"goarch,omitempty" `
2022-11-14 15:01:24 -03:00
Goarm string ` yaml:"goarm,omitempty" json:"goarm,omitempty" jsonschema:"oneof_type=string;integer" `
2022-08-04 15:30:25 -03:00
Gomips string ` yaml:"gomips,omitempty" json:"gomips,omitempty" `
Goamd64 string ` yaml:"goamd64,omitempty" json:"goamd64,omitempty" `
BuildDetails ` yaml:",inline" json:",inline" ` // nolint: tagliatelle
2022-02-02 00:01:34 -03:00
}
type BuildDetails struct {
2022-11-12 03:35:51 +01:00
Buildmode string ` yaml:"buildmode,omitempty" json:"buildmode,omitempty" `
Ldflags StringArray ` yaml:"ldflags,omitempty" json:"ldflags,omitempty" `
Tags FlagArray ` yaml:"tags,omitempty" json:"tags,omitempty" `
Flags FlagArray ` yaml:"flags,omitempty" json:"flags,omitempty" `
Asmflags StringArray ` yaml:"asmflags,omitempty" json:"asmflags,omitempty" `
Gcflags StringArray ` yaml:"gcflags,omitempty" json:"gcflags,omitempty" `
Env [ ] string ` yaml:"env,omitempty" json:"env,omitempty" `
2016-12-21 11:37:31 -02:00
}
2021-11-01 09:31:43 -03:00
type BuildHookConfig struct {
2022-08-04 15:30:25 -03:00
Pre Hooks ` yaml:"pre,omitempty" json:"pre,omitempty" `
Post Hooks ` yaml:"post,omitempty" json:"post,omitempty" `
2020-04-12 16:13:20 +01:00
}
2021-11-01 09:31:43 -03:00
type Hooks [ ] Hook
2020-04-12 16:13:20 +01:00
2020-05-26 00:48:10 -03:00
// UnmarshalYAML is a custom unmarshaler that allows simplified declaration of single command.
2021-11-01 09:31:43 -03:00
func ( bhc * Hooks ) UnmarshalYAML ( unmarshal func ( interface { } ) error ) error {
2020-04-12 16:13:20 +01:00
var singleCmd string
err := unmarshal ( & singleCmd )
if err == nil {
2021-11-01 09:31:43 -03:00
* bhc = [ ] Hook { { Cmd : singleCmd } }
2020-04-12 16:13:20 +01:00
return nil
}
2021-11-01 09:31:43 -03:00
type t Hooks
2020-04-12 16:13:20 +01:00
var hooks t
if err := unmarshal ( & hooks ) ; err != nil {
return err
}
2021-11-01 09:31:43 -03:00
* bhc = ( Hooks ) ( hooks )
2020-04-12 16:13:20 +01:00
return nil
}
2021-11-01 09:31:43 -03:00
type Hook struct {
2022-08-04 15:30:25 -03:00
Dir string ` yaml:"dir,omitempty" json:"dir,omitempty" `
Cmd string ` yaml:"cmd,omitempty" json:"cmd,omitempty" `
Env [ ] string ` yaml:"env,omitempty" json:"env,omitempty" `
Output bool ` yaml:"output,omitempty" json:"output,omitempty" `
2020-04-12 16:13:20 +01:00
}
2020-05-26 00:48:10 -03:00
// UnmarshalYAML is a custom unmarshaler that allows simplified declarations of commands as strings.
2021-11-01 09:31:43 -03:00
func ( bh * Hook ) UnmarshalYAML ( unmarshal func ( interface { } ) error ) error {
2020-04-12 16:13:20 +01:00
var cmd string
if err := unmarshal ( & cmd ) ; err != nil {
2021-11-01 09:31:43 -03:00
type t Hook
2020-04-12 16:13:20 +01:00
var hook t
if err := unmarshal ( & hook ) ; err != nil {
return err
}
2021-11-01 09:31:43 -03:00
* bh = ( Hook ) ( hook )
2020-04-12 16:13:20 +01:00
return nil
}
bh . Cmd = cmd
return nil
}
2022-06-12 22:31:30 -03:00
func ( bh Hook ) JSONSchema ( ) * jsonschema . Schema {
2021-11-01 09:31:43 -03:00
type t Hook
2021-10-26 20:02:03 +02:00
reflector := jsonschema . Reflector {
ExpandedStruct : true ,
}
schema := reflector . Reflect ( & t { } )
2022-06-12 22:31:30 -03:00
return & jsonschema . Schema {
OneOf : [ ] * jsonschema . Schema {
2021-10-26 20:02:03 +02:00
{
Type : "string" ,
} ,
2022-06-12 22:31:30 -03:00
schema ,
2021-10-26 20:02:03 +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 {
2022-08-04 15:30:25 -03:00
Goos string ` yaml:"goos,omitempty" json:"goos,omitempty" `
2023-04-10 17:51:26 -07:00
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" `
2017-04-21 16:01:19 -03:00
}
2021-07-21 22:09:02 -03:00
// File is a file inside an archive.
type File struct {
2022-08-04 15:30:25 -03:00
Source string ` yaml:"src,omitempty" json:"src,omitempty" `
Destination string ` yaml:"dst,omitempty" json:"dst,omitempty" `
StripParent bool ` yaml:"strip_parent,omitempty" json:"strip_parent,omitempty" `
Info FileInfo ` yaml:"info,omitempty" json:"info,omitempty" `
2021-07-21 22:09:02 -03:00
}
// FileInfo is the file info of a file.
type FileInfo struct {
2022-12-14 12:16:43 -03:00
Owner string ` yaml:"owner,omitempty" json:"owner,omitempty" `
Group string ` yaml:"group,omitempty" json:"group,omitempty" `
Mode os . FileMode ` yaml:"mode,omitempty" json:"mode,omitempty" `
MTime string ` yaml:"mtime,omitempty" json:"mtime,omitempty" `
ParsedMTime time . Time ` yaml:"-" json:"-" `
2021-07-21 22:09:02 -03:00
}
// UnmarshalYAML is a custom unmarshaler that wraps strings in arrays.
func ( f * File ) UnmarshalYAML ( unmarshal func ( interface { } ) error ) error {
2022-08-17 23:50:14 -03:00
type t File
2021-07-21 22:09:02 -03:00
var str string
if err := unmarshal ( & str ) ; err == nil {
2021-07-26 08:38:14 -03:00
* f = File { Source : str }
2021-07-21 22:09:02 -03:00
return nil
}
2022-08-17 23:50:14 -03:00
var file t
2021-07-21 22:09:02 -03:00
if err := unmarshal ( & file ) ; err != nil {
return err
}
* f = File ( file )
return nil
}
2022-06-12 22:31:30 -03:00
func ( f File ) JSONSchema ( ) * jsonschema . Schema {
2022-07-26 09:20:32 -03:00
type t File
2021-10-26 20:02:03 +02:00
reflector := jsonschema . Reflector {
ExpandedStruct : true ,
}
2022-07-26 09:20:32 -03:00
schema := reflector . Reflect ( & t { } )
2022-06-12 22:31:30 -03:00
return & jsonschema . Schema {
OneOf : [ ] * jsonschema . Schema {
2021-10-26 20:02:03 +02:00
{
Type : "string" ,
} ,
2022-06-12 22:31:30 -03:00
schema ,
2021-10-26 20:02:03 +02:00
} ,
}
}
2021-10-12 14:55:43 -03:00
// UniversalBinary setups macos universal binaries.
type UniversalBinary struct {
2022-08-04 15:30:25 -03:00
ID string ` yaml:"id,omitempty" json:"id,omitempty" ` // deprecated
IDs [ ] string ` yaml:"ids,omitempty" json:"ids,omitempty" `
NameTemplate string ` yaml:"name_template,omitempty" json:"name_template,omitempty" `
Replace bool ` yaml:"replace,omitempty" json:"replace,omitempty" `
Hooks BuildHookConfig ` yaml:"hooks,omitempty" json:"hooks,omitempty" `
2021-10-12 14:55:43 -03:00
}
2020-05-26 00:48:10 -03:00
// Archive config used for the archive.
2017-01-15 14:37:00 -02:00
type Archive struct {
2022-08-04 15:30:25 -03:00
ID string ` yaml:"id,omitempty" json:"id,omitempty" `
Builds [ ] string ` yaml:"builds,omitempty" json:"builds,omitempty" `
2022-12-14 12:16:03 -03:00
BuildsInfo FileInfo ` yaml:"builds_info,omitempty" json:"builds_info,omitempty" `
2022-08-04 15:30:25 -03:00
NameTemplate string ` yaml:"name_template,omitempty" json:"name_template,omitempty" `
2022-11-25 15:26:14 -03:00
Replacements map [ string ] string ` yaml:"replacements,omitempty" json:"replacements,omitempty" ` // Deprecated: use templates instead
2023-04-10 17:51:26 -07:00
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" `
2022-08-04 15:30:25 -03:00
FormatOverrides [ ] FormatOverride ` yaml:"format_overrides,omitempty" json:"format_overrides,omitempty" `
WrapInDirectory string ` yaml:"wrap_in_directory,omitempty" json:"wrap_in_directory,omitempty" jsonschema:"oneof_type=string;boolean" `
2022-08-15 22:53:36 -03:00
StripParentBinaryFolder bool ` yaml:"strip_parent_binary_folder,omitempty" json:"strip_parent_binary_folder,omitempty" `
feat: better archives relative paths (#3656)
with this patch, a config like:
```yaml
archives:
- format: tar.gz
# this name template makes the OS and Arch compatible with the results of uname.
name_template: >-
{{ .ProjectName }}_
{{- title .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
{{- if .Arm }}v{{ .Arm }}{{ end }}
rlcp: true
files:
- src: "build/**/*"
dst: .
nfpms:
- package_name: foo
contents:
- src: "build/**/*"
dst: usr/share/foo
formats:
- apk
```
will eval this:
<img width="1384" alt="CleanShot 2022-12-21 at 22 21 00@2x"
src="https://user-images.githubusercontent.com/245435/209034244-7c31b5f7-cfcd-4825-bb2f-7dd463c5286a.png">
as much as I would like to make this the default, it would be a breaking
change, so we really can't do it.
If `dst` is empty, it'll have the same behavior as before (no rlcp), and
if `strip_parent` is set, it will also still have the same behavior.
Finally, if the format is binary, `rlcp` is ignored too (as it doesn't
make sense).
So, this only changes if:
- your format is not binary; and
- you have files with `src` and `dst` set
Then, goreleaser will warn you to set `rlcp: true`.
## todo
- [x] docs
- [x] more tests probably
- [x] any ideas for a better name for the new config option?
fixes #3655
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
2022-12-27 17:42:55 -03:00
RLCP bool ` yaml:"rlcp,omitempty" json:"rlcp,omitempty" `
2022-08-04 15:30:25 -03:00
Files [ ] File ` yaml:"files,omitempty" json:"files,omitempty" `
Meta bool ` yaml:"meta,omitempty" json:"meta,omitempty" `
AllowDifferentBinaryCount bool ` yaml:"allow_different_binary_count,omitempty" json:"allow_different_binary_count,omitempty" `
2017-01-14 19:47:15 -02:00
}
2021-11-26 09:59:15 -03:00
type ReleaseNotesMode string
const (
ReleaseNotesModeKeepExisting ReleaseNotesMode = "keep-existing"
ReleaseNotesModeAppend ReleaseNotesMode = "append"
ReleaseNotesModeReplace ReleaseNotesMode = "replace"
ReleaseNotesModePrepend ReleaseNotesMode = "prepend"
)
2020-05-26 00:48:10 -03:00
// Release config used for the GitHub/GitLab release.
2017-01-15 14:37:00 -02:00
type Release struct {
2022-08-04 15:30:25 -03:00
GitHub Repo ` yaml:"github,omitempty" json:"github,omitempty" `
GitLab Repo ` yaml:"gitlab,omitempty" json:"gitlab,omitempty" `
Gitea Repo ` yaml:"gitea,omitempty" json:"gitea,omitempty" `
Draft bool ` yaml:"draft,omitempty" json:"draft,omitempty" `
2022-08-17 22:33:16 -03:00
ReplaceExistingDraft bool ` yaml:"replace_existing_draft,omitempty" json:"replace_existing_draft,omitempty" `
2022-08-22 21:31:28 -03:00
TargetCommitish string ` yaml:"target_commitish,omitempty" json:"target_commitish,omitempty" `
2023-01-23 22:27:01 -03:00
Disable string ` yaml:"disable,omitempty" json:"disable,omitempty" jsonschema:"oneof_type=string;boolean" `
SkipUpload string ` yaml:"skip_upload,omitempty" json:"skip_upload,omitempty" jsonschema:"oneof_type=string;boolean" `
2022-08-04 15:30:25 -03:00
Prerelease string ` yaml:"prerelease,omitempty" json:"prerelease,omitempty" `
NameTemplate string ` yaml:"name_template,omitempty" json:"name_template,omitempty" `
IDs [ ] string ` yaml:"ids,omitempty" json:"ids,omitempty" `
ExtraFiles [ ] ExtraFile ` yaml:"extra_files,omitempty" json:"extra_files,omitempty" `
DiscussionCategoryName string ` yaml:"discussion_category_name,omitempty" json:"discussion_category_name,omitempty" `
Header string ` yaml:"header,omitempty" json:"header,omitempty" `
Footer string ` yaml:"footer,omitempty" json:"footer,omitempty" `
ReleaseNotesMode ReleaseNotesMode ` yaml:"mode,omitempty" json:"mode,omitempty" jsonschema:"enum=keep-existing,enum=append,enum=prepend,enum=replace,default=keep-existing" `
2020-02-11 16:10:41 -03:00
}
2020-07-09 16:40:37 -04:00
// Milestone config used for VCS milestone.
type Milestone struct {
2022-08-04 15:30:25 -03:00
Repo Repo ` yaml:"repo,omitempty" json:"repo,omitempty" `
Close bool ` yaml:"close,omitempty" json:"close,omitempty" `
FailOnError bool ` yaml:"fail_on_error,omitempty" json:"fail_on_error,omitempty" `
NameTemplate string ` yaml:"name_template,omitempty" json:"name_template,omitempty" `
2020-07-09 16:40:37 -04:00
}
2020-05-26 00:48:10 -03:00
// ExtraFile on a release.
2020-02-11 16:10:41 -03:00
type ExtraFile struct {
2022-08-04 15:30:25 -03:00
Glob string ` yaml:"glob,omitempty" json:"glob,omitempty" `
NameTemplate string ` yaml:"name_template,omitempty" json:"name_template,omitempty" `
2017-01-14 14:06:57 -02:00
}
2020-05-26 00:48:10 -03:00
// NFPM config.
2018-02-26 18:49:58 -03:00
type NFPM struct {
2022-08-04 15:30:25 -03:00
NFPMOverridables ` yaml:",inline" json:",inline" ` // nolint: tagliatelle
Overrides map [ string ] NFPMOverridables ` yaml:"overrides,omitempty" json:"overrides,omitempty" `
ID string ` yaml:"id,omitempty" json:"id,omitempty" `
Builds [ ] string ` yaml:"builds,omitempty" json:"builds,omitempty" `
Formats [ ] string ` yaml:"formats,omitempty" json:"formats,omitempty" `
Section string ` yaml:"section,omitempty" json:"section,omitempty" `
Priority string ` yaml:"priority,omitempty" json:"priority,omitempty" `
Vendor string ` yaml:"vendor,omitempty" json:"vendor,omitempty" `
Homepage string ` yaml:"homepage,omitempty" json:"homepage,omitempty" `
Maintainer string ` yaml:"maintainer,omitempty" json:"maintainer,omitempty" `
Description string ` yaml:"description,omitempty" json:"description,omitempty" `
License string ` yaml:"license,omitempty" json:"license,omitempty" `
Bindir string ` yaml:"bindir,omitempty" json:"bindir,omitempty" `
2022-08-16 02:05:46 -03:00
Changelog string ` yaml:"changelog,omitempty" json:"changelog,omitempty" `
2022-08-04 15:30:25 -03:00
Meta bool ` yaml:"meta,omitempty" json:"meta,omitempty" ` // make package without binaries - only deps
2018-04-21 16:48:22 +02:00
}
2020-05-26 00:48:10 -03:00
// NFPMScripts is used to specify maintainer scripts.
2018-04-21 16:48:22 +02:00
type NFPMScripts struct {
2022-08-04 15:30:25 -03:00
PreInstall string ` yaml:"preinstall,omitempty" json:"preinstall,omitempty" `
PostInstall string ` yaml:"postinstall,omitempty" json:"postinstall,omitempty" `
PreRemove string ` yaml:"preremove,omitempty" json:"preremove,omitempty" `
PostRemove string ` yaml:"postremove,omitempty" json:"postremove,omitempty" `
2018-04-21 16:48:22 +02:00
}
2020-11-05 21:47:55 +00:00
type NFPMRPMSignature struct {
// PGP secret key, can be ASCII-armored
2022-08-04 15:30:25 -03:00
KeyFile string ` yaml:"key_file,omitempty" json:"key_file,omitempty" `
KeyPassphrase string ` yaml:"-" json:"-" ` // populated from environment variable
2020-11-05 21:47:55 +00:00
}
2021-04-28 16:01:03 +03:00
// NFPMRPMScripts represents scripts only available on RPM packages.
type NFPMRPMScripts struct {
2022-08-04 15:30:25 -03:00
PreTrans string ` yaml:"pretrans,omitempty" json:"pretrans,omitempty" `
PostTrans string ` yaml:"posttrans,omitempty" json:"posttrans,omitempty" `
2021-04-28 16:01:03 +03:00
}
2020-11-05 21:47:55 +00:00
// NFPMRPM is custom configs that are only available on RPM packages.
type NFPMRPM struct {
2022-08-04 15:30:25 -03:00
Summary string ` yaml:"summary,omitempty" json:"summary,omitempty" `
Group string ` yaml:"group,omitempty" json:"group,omitempty" `
Compression string ` yaml:"compression,omitempty" json:"compression,omitempty" `
Signature NFPMRPMSignature ` yaml:"signature,omitempty" json:"signature,omitempty" `
Scripts NFPMRPMScripts ` yaml:"scripts,omitempty" json:"scripts,omitempty" `
2020-11-05 21:47:55 +00:00
}
// NFPMDebScripts is scripts only available on deb packages.
type NFPMDebScripts struct {
2022-08-04 15:30:25 -03:00
Rules string ` yaml:"rules,omitempty" json:"rules,omitempty" `
Templates string ` yaml:"templates,omitempty" json:"templates,omitempty" `
2020-11-05 21:47:55 +00:00
}
// NFPMDebTriggers contains triggers only available for deb packages.
// https://wiki.debian.org/DpkgTriggers
// https://man7.org/linux/man-pages/man5/deb-triggers.5.html
type NFPMDebTriggers struct {
2022-08-04 15:30:25 -03:00
Interest [ ] string ` yaml:"interest,omitempty" json:"interest,omitempty" `
InterestAwait [ ] string ` yaml:"interest_await,omitempty" json:"interest_await,omitempty" `
InterestNoAwait [ ] string ` yaml:"interest_noawait,omitempty" json:"interest_noawait,omitempty" `
Activate [ ] string ` yaml:"activate,omitempty" json:"activate,omitempty" `
ActivateAwait [ ] string ` yaml:"activate_await,omitempty" json:"activate_await,omitempty" `
ActivateNoAwait [ ] string ` yaml:"activate_noawait,omitempty" json:"activate_noawait,omitempty" `
2020-11-05 21:47:55 +00:00
}
// NFPMDebSignature contains config for signing deb packages created by nfpm.
type NFPMDebSignature struct {
// PGP secret key, can be ASCII-armored
2022-08-04 15:30:25 -03:00
KeyFile string ` yaml:"key_file,omitempty" json:"key_file,omitempty" `
KeyPassphrase string ` yaml:"-" json:"-" ` // populated from environment variable
2020-11-05 21:47:55 +00:00
// origin, maint or archive (defaults to origin)
2022-08-04 15:30:25 -03:00
Type string ` yaml:"type,omitempty" json:"type,omitempty" `
2020-11-05 21:47:55 +00:00
}
// NFPMDeb is custom configs that are only available on deb packages.
type NFPMDeb struct {
2022-08-04 15:30:25 -03:00
Scripts NFPMDebScripts ` yaml:"scripts,omitempty" json:"scripts,omitempty" `
Triggers NFPMDebTriggers ` yaml:"triggers,omitempty" json:"triggers,omitempty" `
Breaks [ ] string ` yaml:"breaks,omitempty" json:"breaks,omitempty" `
Signature NFPMDebSignature ` yaml:"signature,omitempty" json:"signature,omitempty" `
Lintian [ ] string ` yaml:"lintian_overrides,omitempty" json:"lintian_overrides,omitempty" `
2020-11-05 21:47:55 +00:00
}
2021-06-20 19:34:09 +02:00
type NFPMAPKScripts struct {
2022-08-04 15:30:25 -03:00
PreUpgrade string ` yaml:"preupgrade,omitempty" json:"preupgrade,omitempty" `
PostUpgrade string ` yaml:"postupgrade,omitempty" json:"postupgrade,omitempty" `
2021-06-20 19:34:09 +02:00
}
2020-11-05 21:47:55 +00:00
// NFPMAPKSignature contains config for signing apk packages created by nfpm.
type NFPMAPKSignature struct {
// RSA private key in PEM format
2022-08-04 15:30:25 -03:00
KeyFile string ` yaml:"key_file,omitempty" json:"key_file,omitempty" `
KeyPassphrase string ` yaml:"-" json:"-" ` // populated from environment variable
2020-11-05 21:47:55 +00:00
// defaults to <maintainer email>.rsa.pub
2022-08-04 15:30:25 -03:00
KeyName string ` yaml:"key_name,omitempty" json:"key_name,omitempty" `
2020-11-05 21:47:55 +00:00
}
// NFPMAPK is custom config only available on apk packages.
type NFPMAPK struct {
2022-08-04 15:30:25 -03:00
Scripts NFPMAPKScripts ` yaml:"scripts,omitempty" json:"scripts,omitempty" `
Signature NFPMAPKSignature ` yaml:"signature,omitempty" json:"signature,omitempty" `
2020-11-05 21:47:55 +00:00
}
2022-11-02 18:30:06 +00:00
type NFPMArchLinuxScripts struct {
PreUpgrade string ` yaml:"preupgrade,omitempty" json:"preupgrade,omitempty" `
PostUpgrade string ` yaml:"postupgrade,omitempty" json:"postupgrade,omitempty" `
}
type NFPMArchLinux struct {
Pkgbase string ` yaml:"pkgbase,omitempty" json:"pkgbase,omitempty" `
Packager string ` yaml:"packager,omitempty" json:"packager,omitempty" `
Scripts NFPMArchLinuxScripts ` yaml:"scripts,omitempty" json:"scripts,omitempty" `
}
2020-05-26 00:48:10 -03:00
// NFPMOverridables is used to specify per package format settings.
2018-04-21 16:48:22 +02:00
type NFPMOverridables struct {
2022-08-04 15:30:25 -03:00
FileNameTemplate string ` yaml:"file_name_template,omitempty" json:"file_name_template,omitempty" `
PackageName string ` yaml:"package_name,omitempty" json:"package_name,omitempty" `
Epoch string ` yaml:"epoch,omitempty" json:"epoch,omitempty" `
Release string ` yaml:"release,omitempty" json:"release,omitempty" `
Prerelease string ` yaml:"prerelease,omitempty" json:"prerelease,omitempty" `
VersionMetadata string ` yaml:"version_metadata,omitempty" json:"version_metadata,omitempty" `
2022-11-25 15:26:14 -03:00
Replacements map [ string ] string ` yaml:"replacements,omitempty" json:"replacements,omitempty" ` // Deprecated: use templates instead
2022-08-04 15:30:25 -03:00
Dependencies [ ] string ` yaml:"dependencies,omitempty" json:"dependencies,omitempty" `
Recommends [ ] string ` yaml:"recommends,omitempty" json:"recommends,omitempty" `
Suggests [ ] string ` yaml:"suggests,omitempty" json:"suggests,omitempty" `
Conflicts [ ] string ` yaml:"conflicts,omitempty" json:"conflicts,omitempty" `
Replaces [ ] string ` yaml:"replaces,omitempty" json:"replaces,omitempty" `
2022-08-07 12:13:20 -03:00
Provides [ ] string ` yaml:"provides,omitempty" json:"provides,omitempty" `
2022-08-04 15:30:25 -03:00
Contents files . Contents ` yaml:"contents,omitempty" json:"contents,omitempty" `
Scripts NFPMScripts ` yaml:"scripts,omitempty" json:"scripts,omitempty" `
RPM NFPMRPM ` yaml:"rpm,omitempty" json:"rpm,omitempty" `
Deb NFPMDeb ` yaml:"deb,omitempty" json:"deb,omitempty" `
APK NFPMAPK ` yaml:"apk,omitempty" json:"apk,omitempty" `
2022-11-02 18:30:06 +00:00
ArchLinux NFPMArchLinux ` yaml:"archlinux,omitempty" json:"archlinux,omitempty" `
2018-04-18 23:56:15 +02:00
}
2021-12-11 22:21:51 -05:00
// SBOM config.
type SBOM struct {
2022-08-04 15:30:25 -03:00
ID string ` yaml:"id,omitempty" json:"id,omitempty" `
Cmd string ` yaml:"cmd,omitempty" json:"cmd,omitempty" `
Env [ ] string ` yaml:"env,omitempty" json:"env,omitempty" `
Args [ ] string ` yaml:"args,omitempty" json:"args,omitempty" `
Documents [ ] string ` yaml:"documents,omitempty" json:"documents,omitempty" `
Artifacts string ` yaml:"artifacts,omitempty" json:"artifacts,omitempty" `
IDs [ ] string ` yaml:"ids,omitempty" json:"ids,omitempty" `
2021-12-11 22:21:51 -05:00
}
2020-05-26 00:48:10 -03:00
// Sign config.
2017-12-13 17:14:01 +01:00
type Sign struct {
2022-08-04 15:30:25 -03:00
ID string ` yaml:"id,omitempty" json:"id,omitempty" `
Cmd string ` yaml:"cmd,omitempty" json:"cmd,omitempty" `
Args [ ] string ` yaml:"args,omitempty" json:"args,omitempty" `
Signature string ` yaml:"signature,omitempty" json:"signature,omitempty" `
2022-11-29 21:38:51 -03:00
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" `
2022-08-04 15:30:25 -03:00
IDs [ ] string ` yaml:"ids,omitempty" json:"ids,omitempty" `
Stdin * string ` yaml:"stdin,omitempty" json:"stdin,omitempty" `
StdinFile string ` yaml:"stdin_file,omitempty" json:"stdin_file,omitempty" `
Env [ ] string ` yaml:"env,omitempty" json:"env,omitempty" `
Certificate string ` yaml:"certificate,omitempty" json:"certificate,omitempty" `
Output bool ` yaml:"output,omitempty" json:"output,omitempty" `
2017-12-13 17:14:01 +01:00
}
2020-05-26 00:48:10 -03:00
// SnapcraftAppMetadata for the binaries that will be in the snap package.
2017-08-04 05:42:55 +00:00
type SnapcraftAppMetadata struct {
2022-08-04 15:30:25 -03:00
Command string ` yaml:"command" json:"command" `
Args string ` yaml:"args,omitempty" json:"args,omitempty" `
Adapter string ` yaml:"adapter,omitempty" json:"adapter,omitempty" `
After [ ] string ` yaml:"after,omitempty" json:"after,omitempty" `
Aliases [ ] string ` yaml:"aliases,omitempty" json:"aliases,omitempty" `
Autostart string ` yaml:"autostart,omitempty" json:"autostart,omitempty" `
Before [ ] string ` yaml:"before,omitempty" json:"before,omitempty" `
BusName string ` yaml:"bus_name,omitempty" json:"bus_name,omitempty" `
CommandChain [ ] string ` yaml:"command_chain,omitempty" json:"command_chain,omitempty" `
CommonID string ` yaml:"common_id,omitempty" json:"common_id,omitempty" `
Completer string ` yaml:"completer,omitempty" json:"completer,omitempty" `
Daemon string ` yaml:"daemon,omitempty" json:"daemon,omitempty" `
Desktop string ` yaml:"desktop,omitempty" json:"desktop,omitempty" `
Environment map [ string ] interface { } ` yaml:"environment,omitempty" json:"environment,omitempty" `
Extensions [ ] string ` yaml:"extensions,omitempty" json:"extensions,omitempty" `
InstallMode string ` yaml:"install_mode,omitempty" json:"install_mode,omitempty" `
Passthrough map [ string ] interface { } ` yaml:"passthrough,omitempty" json:"passthrough,omitempty" `
Plugs [ ] string ` yaml:"plugs,omitempty" json:"plugs,omitempty" `
PostStopCommand string ` yaml:"post_stop_command,omitempty" json:"post_stop_command,omitempty" `
RefreshMode string ` yaml:"refresh_mode,omitempty" json:"refresh_mode,omitempty" `
ReloadCommand string ` yaml:"reload_command,omitempty" json:"reload_command,omitempty" `
RestartCondition string ` yaml:"restart_condition,omitempty" json:"restart_condition,omitempty" `
RestartDelay string ` yaml:"restart_delay,omitempty" json:"restart_delay,omitempty" `
Slots [ ] string ` yaml:"slots,omitempty" json:"slots,omitempty" `
Sockets map [ string ] interface { } ` yaml:"sockets,omitempty" json:"sockets,omitempty" `
StartTimeout string ` yaml:"start_timeout,omitempty" json:"start_timeout,omitempty" `
StopCommand string ` yaml:"stop_command,omitempty" json:"stop_command,omitempty" `
StopMode string ` yaml:"stop_mode,omitempty" json:"stop_mode,omitempty" `
StopTimeout string ` yaml:"stop_timeout,omitempty" json:"stop_timeout,omitempty" `
Timer string ` yaml:"timer,omitempty" json:"timer,omitempty" `
WatchdogTimeout string ` yaml:"watchdog_timeout,omitempty" json:"watchdog_timeout,omitempty" `
2017-08-04 05:42:55 +00:00
}
2021-03-17 21:18:56 +08:00
type SnapcraftLayoutMetadata struct {
2022-08-04 15:30:25 -03:00
Symlink string ` yaml:"symlink,omitempty" json:"symlink,omitempty" `
Bind string ` yaml:"bind,omitempty" json:"bind,omitempty" `
BindFile string ` yaml:"bind_file,omitempty" json:"bind_file,omitempty" `
Type string ` yaml:"type,omitempty" json:"type,omitempty" `
2021-03-17 21:18:56 +08:00
}
2020-05-26 00:48:10 -03:00
// Snapcraft config.
2017-07-27 00:30:48 +00:00
type Snapcraft struct {
2022-08-04 15:30:25 -03:00
NameTemplate string ` yaml:"name_template,omitempty" json:"name_template,omitempty" `
2022-11-25 15:26:14 -03:00
Replacements map [ string ] string ` yaml:"replacements,omitempty" json:"replacements,omitempty" ` // Deprecated: use templates instead.
2022-08-04 15:30:25 -03:00
Publish bool ` yaml:"publish,omitempty" json:"publish,omitempty" `
ID string ` yaml:"id,omitempty" json:"id,omitempty" `
Builds [ ] string ` yaml:"builds,omitempty" json:"builds,omitempty" `
Name string ` yaml:"name,omitempty" json:"name,omitempty" `
Summary string ` yaml:"summary,omitempty" json:"summary,omitempty" `
Description string ` yaml:"description,omitempty" json:"description,omitempty" `
Base string ` yaml:"base,omitempty" json:"base,omitempty" `
License string ` yaml:"license,omitempty" json:"license,omitempty" `
Grade string ` yaml:"grade,omitempty" json:"grade,omitempty" `
ChannelTemplates [ ] string ` yaml:"channel_templates,omitempty" json:"channel_templates,omitempty" `
Confinement string ` yaml:"confinement,omitempty" json:"confinement,omitempty" `
Layout map [ string ] SnapcraftLayoutMetadata ` yaml:"layout,omitempty" json:"layout,omitempty" `
Apps map [ string ] SnapcraftAppMetadata ` yaml:"apps,omitempty" json:"apps,omitempty" `
Plugs map [ string ] interface { } ` yaml:"plugs,omitempty" json:"plugs,omitempty" `
Files [ ] SnapcraftExtraFiles ` yaml:"extra_files,omitempty" json:"extra_files,omitempty" `
2020-06-06 21:07:18 +03:00
}
// SnapcraftExtraFiles config.
type SnapcraftExtraFiles struct {
2022-08-04 15:30:25 -03:00
Source string ` yaml:"source" json:"source" `
Destination string ` yaml:"destination,omitempty" json:"destination,omitempty" `
Mode uint32 ` yaml:"mode,omitempty" json:"mode,omitempty" `
2017-07-27 00:30:48 +00:00
}
2020-05-26 00:48:10 -03:00
// Snapshot config.
2017-04-29 12:49:22 +02:00
type Snapshot struct {
2022-08-04 15:30:25 -03:00
NameTemplate string ` yaml:"name_template,omitempty" json:"name_template,omitempty" `
2017-01-29 21:55:32 -02:00
}
2020-05-26 00:48:10 -03:00
// Checksum config.
2017-08-27 20:45:33 -03:00
type Checksum struct {
2022-08-04 15:30:25 -03:00
NameTemplate string ` yaml:"name_template,omitempty" json:"name_template,omitempty" `
Algorithm string ` yaml:"algorithm,omitempty" json:"algorithm,omitempty" `
IDs [ ] string ` yaml:"ids,omitempty" json:"ids,omitempty" `
Disable bool ` yaml:"disable,omitempty" json:"disable,omitempty" `
ExtraFiles [ ] ExtraFile ` yaml:"extra_files,omitempty" json:"extra_files,omitempty" `
2017-08-27 20:45:33 -03:00
}
2020-05-26 00:48:10 -03:00
// Docker image config.
2017-09-11 23:31:00 -03:00
type Docker struct {
2022-08-04 15:30:25 -03:00
ID string ` yaml:"id,omitempty" json:"id,omitempty" `
IDs [ ] string ` yaml:"ids,omitempty" json:"ids,omitempty" `
Goos string ` yaml:"goos,omitempty" json:"goos,omitempty" `
Goarch string ` yaml:"goarch,omitempty" json:"goarch,omitempty" `
2022-11-14 15:01:24 -03:00
Goarm string ` yaml:"goarm,omitempty" json:"goarm,omitempty" jsonschema:"oneof_type=string;integer" `
2022-08-04 15:30:25 -03:00
Goamd64 string ` yaml:"goamd64,omitempty" json:"goamd64,omitempty" `
Dockerfile string ` yaml:"dockerfile,omitempty" json:"dockerfile,omitempty" `
ImageTemplates [ ] string ` yaml:"image_templates,omitempty" json:"image_templates,omitempty" `
2022-11-14 15:01:24 -03:00
SkipPush string ` yaml:"skip_push,omitempty" json:"skip_push,omitempty" jsonschema:"oneof_type=string;boolean" `
2022-08-04 15:30:25 -03:00
Files [ ] string ` yaml:"extra_files,omitempty" json:"extra_files,omitempty" `
BuildFlagTemplates [ ] string ` yaml:"build_flag_templates,omitempty" json:"build_flag_templates,omitempty" `
PushFlags [ ] string ` yaml:"push_flags,omitempty" json:"push_flags,omitempty" `
Use string ` yaml:"use,omitempty" json:"use,omitempty" `
2017-09-11 23:31:00 -03:00
}
2020-11-28 16:26:37 -03:00
// DockerManifest config.
type DockerManifest struct {
2022-08-04 15:30:25 -03:00
ID string ` yaml:"id,omitempty" json:"id,omitempty" `
NameTemplate string ` yaml:"name_template,omitempty" json:"name_template,omitempty" `
2022-11-14 15:01:24 -03:00
SkipPush string ` yaml:"skip_push,omitempty" json:"skip_push,omitempty" jsonschema:"oneof_type=string;boolean" `
2022-08-04 15:30:25 -03:00
ImageTemplates [ ] string ` yaml:"image_templates,omitempty" json:"image_templates,omitempty" `
CreateFlags [ ] string ` yaml:"create_flags,omitempty" json:"create_flags,omitempty" `
PushFlags [ ] string ` yaml:"push_flags,omitempty" json:"push_flags,omitempty" `
Use string ` yaml:"use,omitempty" json:"use,omitempty" `
2020-11-28 16:26:37 -03:00
}
2020-05-26 00:48:10 -03:00
// Filters config.
2017-10-15 20:21:35 -02:00
type Filters struct {
2022-08-04 15:30:25 -03:00
Exclude [ ] string ` yaml:"exclude,omitempty" json:"exclude,omitempty" `
2017-10-15 20:21:35 -02:00
}
2020-05-26 00:48:10 -03:00
// Changelog Config.
2017-10-15 20:21:35 -02:00
type Changelog struct {
2022-08-04 15:30:25 -03:00
Filters Filters ` yaml:"filters,omitempty" json:"filters,omitempty" `
2023-01-04 22:31:46 -03:00
Sort string ` yaml:"sort,omitempty" json:"sort,omitempty" jsonschema:"enum=asc,enum=desc,enum=,default=" `
2023-03-03 09:49:41 -03:00
Skip string ` yaml:"skip,omitempty" json:"skip,omitempty" jsonschema:"oneof_type=string;boolean" ` // TODO(caarlos0): rename to Disable to match other pipes
2022-08-04 15:30:25 -03:00
Use string ` yaml:"use,omitempty" json:"use,omitempty" jsonschema:"enum=git,enum=github,enum=github-native,enum=gitlab,default=git" `
2023-01-07 18:37:44 -03:00
Groups [ ] ChangelogGroup ` yaml:"groups,omitempty" json:"groups,omitempty" `
2022-08-30 12:04:01 -03:00
Abbrev int ` yaml:"abbrev,omitempty" json:"abbrev,omitempty" `
2021-11-24 02:23:53 +01:00
}
2023-01-07 18:37:44 -03:00
// ChangelogGroup holds the grouping criteria for the changelog.
type ChangelogGroup struct {
2022-08-04 15:30:25 -03:00
Title string ` yaml:"title,omitempty" json:"title,omitempty" `
Regexp string ` yaml:"regexp,omitempty" json:"regexp,omitempty" `
Order int ` yaml:"order,omitempty" json:"order,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
2020-05-26 00:48:10 -03:00
// values like the github token for example.
2018-02-03 00:06:48 -02:00
type EnvFiles struct {
2022-08-04 15:30:25 -03:00
GitHubToken string ` yaml:"github_token,omitempty" json:"github_token,omitempty" `
GitLabToken string ` yaml:"gitlab_token,omitempty" json:"gitlab_token,omitempty" `
GiteaToken string ` yaml:"gitea_token,omitempty" json:"gitea_token,omitempty" `
2018-02-03 00:06:48 -02:00
}
2020-05-26 00:48:10 -03:00
// Before config.
2018-03-28 15:31:09 +02:00
type Before struct {
2022-08-04 15:30:25 -03:00
Hooks [ ] string ` yaml:"hooks,omitempty" json:"hooks,omitempty" `
2018-03-28 15:31:09 +02:00
}
2020-05-26 00:48:10 -03:00
// Blob contains config for GO CDK blob.
2019-06-05 15:51:01 +02:00
type Blob struct {
2022-08-04 15:30:25 -03:00
Bucket string ` yaml:"bucket,omitempty" json:"bucket,omitempty" `
Provider string ` yaml:"provider,omitempty" json:"provider,omitempty" `
Region string ` yaml:"region,omitempty" json:"region,omitempty" `
DisableSSL bool ` yaml:"disableSSL,omitempty" json:"disableSSL,omitempty" ` // nolint:tagliatelle // TODO(caarlos0): rename to disable_ssl
Folder string ` yaml:"folder,omitempty" json:"folder,omitempty" `
KMSKey string ` yaml:"kmskey,omitempty" json:"kmskey,omitempty" `
IDs [ ] string ` yaml:"ids,omitempty" json:"ids,omitempty" `
Endpoint string ` yaml:"endpoint,omitempty" json:"endpoint,omitempty" ` // used for minio for example
ExtraFiles [ ] ExtraFile ` yaml:"extra_files,omitempty" json:"extra_files,omitempty" `
2023-03-23 08:59:04 -03:00
Disable string ` yaml:"disable,omitempty" json:"disable,omitempty" jsonschema:"oneof_type=string;boolean" `
2019-06-05 15:51:01 +02:00
}
2020-05-26 00:48:10 -03:00
// Upload configuration.
2019-11-18 10:34:17 -03:00
type Upload struct {
2022-08-04 15:30:25 -03:00
Name string ` yaml:"name,omitempty" json:"name,omitempty" `
IDs [ ] string ` yaml:"ids,omitempty" json:"ids,omitempty" `
Exts [ ] string ` yaml:"exts,omitempty" json:"exts,omitempty" `
Target string ` yaml:"target,omitempty" json:"target,omitempty" `
Username string ` yaml:"username,omitempty" json:"username,omitempty" `
Mode string ` yaml:"mode,omitempty" json:"mode,omitempty" `
Method string ` yaml:"method,omitempty" json:"method,omitempty" `
ChecksumHeader string ` yaml:"checksum_header,omitempty" json:"checksum_header,omitempty" `
2022-09-27 10:12:34 -03:00
ClientX509Cert string ` yaml:"client_x509_cert,omitempty" json:"client_x509_cert,omitempty" `
ClientX509Key string ` yaml:"client_x509_key,omitempty" json:"client_x509_key,omitempty" `
2022-08-04 15:30:25 -03:00
TrustedCerts string ` yaml:"trusted_certificates,omitempty" json:"trusted_certificates,omitempty" `
Checksum bool ` yaml:"checksum,omitempty" json:"checksum,omitempty" `
Signature bool ` yaml:"signature,omitempty" json:"signature,omitempty" `
CustomArtifactName bool ` yaml:"custom_artifact_name,omitempty" json:"custom_artifact_name,omitempty" `
CustomHeaders map [ string ] string ` yaml:"custom_headers,omitempty" json:"custom_headers,omitempty" `
2018-05-21 17:37:05 -03:00
}
2020-05-26 00:48:10 -03:00
// Publisher configuration.
2020-05-10 17:03:49 +01:00
type Publisher struct {
2022-08-04 15:30:25 -03:00
Name string ` yaml:"name,omitempty" json:"name,omitempty" `
IDs [ ] string ` yaml:"ids,omitempty" json:"ids,omitempty" `
Checksum bool ` yaml:"checksum,omitempty" json:"checksum,omitempty" `
Signature bool ` yaml:"signature,omitempty" json:"signature,omitempty" `
Dir string ` yaml:"dir,omitempty" json:"dir,omitempty" `
Cmd string ` yaml:"cmd,omitempty" json:"cmd,omitempty" `
Env [ ] string ` yaml:"env,omitempty" json:"env,omitempty" `
ExtraFiles [ ] ExtraFile ` yaml:"extra_files,omitempty" json:"extra_files,omitempty" `
2020-05-10 17:03:49 +01:00
}
2020-05-26 00:48:10 -03:00
// Source configuration.
2020-04-12 11:47:46 -03:00
type Source struct {
2022-08-25 02:15:37 -03:00
NameTemplate string ` yaml:"name_template,omitempty" json:"name_template,omitempty" `
2023-04-07 22:53:15 -03:00
Format string ` yaml:"format,omitempty" json:"format,omitempty" jsonschema:"enum=tar,enum=tgz,enum=tar.gz,enum=zip,default=tar.gz" `
2022-08-25 02:15:37 -03:00
Enabled bool ` yaml:"enabled,omitempty" json:"enabled,omitempty" `
PrefixTemplate string ` yaml:"prefix_template,omitempty" json:"prefix_template,omitempty" `
Files [ ] File ` yaml:"files,omitempty" json:"files,omitempty" `
feat: better archives relative paths (#3656)
with this patch, a config like:
```yaml
archives:
- format: tar.gz
# this name template makes the OS and Arch compatible with the results of uname.
name_template: >-
{{ .ProjectName }}_
{{- title .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
{{- if .Arm }}v{{ .Arm }}{{ end }}
rlcp: true
files:
- src: "build/**/*"
dst: .
nfpms:
- package_name: foo
contents:
- src: "build/**/*"
dst: usr/share/foo
formats:
- apk
```
will eval this:
<img width="1384" alt="CleanShot 2022-12-21 at 22 21 00@2x"
src="https://user-images.githubusercontent.com/245435/209034244-7c31b5f7-cfcd-4825-bb2f-7dd463c5286a.png">
as much as I would like to make this the default, it would be a breaking
change, so we really can't do it.
If `dst` is empty, it'll have the same behavior as before (no rlcp), and
if `strip_parent` is set, it will also still have the same behavior.
Finally, if the format is binary, `rlcp` is ignored too (as it doesn't
make sense).
So, this only changes if:
- your format is not binary; and
- you have files with `src` and `dst` set
Then, goreleaser will warn you to set `rlcp: true`.
## todo
- [x] docs
- [x] more tests probably
- [x] any ideas for a better name for the new config option?
fixes #3655
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
2022-12-27 17:42:55 -03:00
RLCP bool ` yaml:"rlcp,omitempty" json:"rlcp,omitempty" `
2020-04-12 11:47:46 -03:00
}
2020-05-26 00:48:10 -03:00
// Project includes all project configuration.
2017-01-15 14:37:00 -02:00
type Project struct {
2022-08-04 15:30:25 -03:00
ProjectName string ` yaml:"project_name,omitempty" json:"project_name,omitempty" `
Env [ ] string ` yaml:"env,omitempty" json:"env,omitempty" `
Release Release ` yaml:"release,omitempty" json:"release,omitempty" `
Milestones [ ] Milestone ` yaml:"milestones,omitempty" json:"milestones,omitempty" `
Brews [ ] Homebrew ` yaml:"brews,omitempty" json:"brews,omitempty" `
AURs [ ] AUR ` yaml:"aurs,omitempty" json:"aurs,omitempty" `
Krews [ ] Krew ` yaml:"krews,omitempty" json:"krews,omitempty" `
2023-01-16 22:34:49 -03:00
Kos [ ] Ko ` yaml:"kos,omitempty" json:"kos,omitempty" `
2022-08-04 15:30:25 -03:00
Scoop Scoop ` yaml:"scoop,omitempty" json:"scoop,omitempty" `
Builds [ ] Build ` yaml:"builds,omitempty" json:"builds,omitempty" `
Archives [ ] Archive ` yaml:"archives,omitempty" json:"archives,omitempty" `
NFPMs [ ] NFPM ` yaml:"nfpms,omitempty" json:"nfpms,omitempty" `
Snapcrafts [ ] Snapcraft ` yaml:"snapcrafts,omitempty" json:"snapcrafts,omitempty" `
Snapshot Snapshot ` yaml:"snapshot,omitempty" json:"snapshot,omitempty" `
Checksum Checksum ` yaml:"checksum,omitempty" json:"checksum,omitempty" `
Dockers [ ] Docker ` yaml:"dockers,omitempty" json:"dockers,omitempty" `
DockerManifests [ ] DockerManifest ` yaml:"docker_manifests,omitempty" json:"docker_manifests,omitempty" `
Artifactories [ ] Upload ` yaml:"artifactories,omitempty" json:"artifactories,omitempty" `
Uploads [ ] Upload ` yaml:"uploads,omitempty" json:"uploads,omitempty" `
Blobs [ ] Blob ` yaml:"blobs,omitempty" json:"blobs,omitempty" `
Publishers [ ] Publisher ` yaml:"publishers,omitempty" json:"publishers,omitempty" `
Changelog Changelog ` yaml:"changelog,omitempty" json:"changelog,omitempty" `
Dist string ` yaml:"dist,omitempty" json:"dist,omitempty" `
Signs [ ] Sign ` yaml:"signs,omitempty" json:"signs,omitempty" `
DockerSigns [ ] Sign ` yaml:"docker_signs,omitempty" json:"docker_signs,omitempty" `
EnvFiles EnvFiles ` yaml:"env_files,omitempty" json:"env_files,omitempty" `
Before Before ` yaml:"before,omitempty" json:"before,omitempty" `
Source Source ` yaml:"source,omitempty" json:"source,omitempty" `
GoMod GoMod ` yaml:"gomod,omitempty" json:"gomod,omitempty" `
Announce Announce ` yaml:"announce,omitempty" json:"announce,omitempty" `
SBOMs [ ] SBOM ` yaml:"sboms,omitempty" json:"sboms,omitempty" `
2022-12-18 16:42:03 -03:00
Chocolateys [ ] Chocolatey ` yaml:"chocolateys,omitempty" json:"chocolateys,omitempty" `
2022-12-02 21:50:04 -03:00
Git Git ` yaml:"git,omitempty" json:"git,omitempty" `
2022-08-04 15:30:25 -03:00
UniversalBinaries [ ] UniversalBinary ` yaml:"universal_binaries,omitempty" json:"universal_binaries,omitempty" `
2021-10-12 14:55:43 -03:00
2017-07-01 21:27:30 -03:00
// this is a hack ¯\_(ツ)_/¯
2023-02-09 08:56:37 -03:00
SingleBuild Build ` yaml:"build,omitempty" json:"build,omitempty" jsonschema_description:"deprecated: use builds instead" ` // deprecated
2017-07-01 21:27:30 -03:00
2017-09-26 18:33:22 -03:00
// should be set if using github enterprise
2022-08-04 15:30:25 -03:00
GitHubURLs GitHubURLs ` yaml:"github_urls,omitempty" json:"github_urls,omitempty" `
2019-06-29 16:02:40 +02:00
// should be set if using a private gitlab
2022-08-04 15:30:25 -03:00
GitLabURLs GitLabURLs ` yaml:"gitlab_urls,omitempty" json:"gitlab_urls,omitempty" `
2019-08-26 10:31:38 +03:00
// should be set if using Gitea
2022-08-04 15:30:25 -03:00
GiteaURLs GiteaURLs ` yaml:"gitea_urls,omitempty" json:"gitea_urls,omitempty" `
2016-12-21 10:35:34 -02:00
}
2021-03-30 21:06:25 -03:00
type GoMod struct {
2022-08-04 15:30:25 -03:00
Proxy bool ` yaml:"proxy,omitempty" json:"proxy,omitempty" `
Env [ ] string ` yaml:"env,omitempty" json:"env,omitempty" `
GoBinary string ` yaml:"gobinary,omitempty" json:"gobinary,omitempty" `
Mod string ` yaml:"mod,omitempty" json:"mod,omitempty" `
2021-03-30 21:06:25 -03:00
}
2021-05-25 00:19:06 -03:00
type Announce struct {
2023-02-09 06:11:47 -06:00
Skip string ` yaml:"skip,omitempty" json:"skip,omitempty" jsonschema:"oneof_type=string;boolean" `
Twitter Twitter ` yaml:"twitter,omitempty" json:"twitter,omitempty" `
Mastodon Mastodon ` yaml:"mastodon,omitempty" json:"mastodon,omitempty" `
Reddit Reddit ` yaml:"reddit,omitempty" json:"reddit,omitempty" `
Slack Slack ` yaml:"slack,omitempty" json:"slack,omitempty" `
Discord Discord ` yaml:"discord,omitempty" json:"discord,omitempty" `
Teams Teams ` yaml:"teams,omitempty" json:"teams,omitempty" `
SMTP SMTP ` yaml:"smtp,omitempty" json:"smtp,omitempty" `
Mattermost Mattermost ` yaml:"mattermost,omitempty" json:"mattermost,omitempty" `
LinkedIn LinkedIn ` yaml:"linkedin,omitempty" json:"linkedin,omitempty" `
Telegram Telegram ` yaml:"telegram,omitempty" json:"telegram,omitempty" `
Webhook Webhook ` yaml:"webhook,omitempty" json:"webhook,omitempty" `
OpenCollective OpenCollective ` yaml:"opencollective,omitempty" json:"opencolletive,omitempty" `
2022-01-08 18:46:27 +01:00
}
type Webhook struct {
2022-08-04 15:30:25 -03:00
Enabled bool ` yaml:"enabled,omitempty" json:"enabled,omitempty" `
SkipTLSVerify bool ` yaml:"skip_tls_verify,omitempty" json:"skip_tls_verify,omitempty" `
MessageTemplate string ` yaml:"message_template,omitempty" json:"message_template,omitempty" `
EndpointURL string ` yaml:"endpoint_url,omitempty" json:"endpoint_url,omitempty" `
Headers map [ string ] string ` yaml:"headers,omitempty" json:"headers,omitempty" `
ContentType string ` yaml:"content_type,omitempty" json:"content_type,omitempty" `
2021-05-25 00:19:06 -03:00
}
type Twitter struct {
2022-08-04 15:30:25 -03:00
Enabled bool ` yaml:"enabled,omitempty" json:"enabled,omitempty" `
MessageTemplate string ` yaml:"message_template,omitempty" json:"message_template,omitempty" `
2021-05-25 00:19:06 -03:00
}
2022-11-17 17:40:00 -06:00
type Mastodon struct {
Enabled bool ` yaml:"enabled,omitempty" json:"enabled,omitempty" `
MessageTemplate string ` yaml:"message_template,omitempty" json:"message_template,omitempty" `
2022-11-17 20:54:57 -03:00
Server string ` yaml:"server" json:"server" `
2022-11-17 17:40:00 -06:00
}
2021-08-31 16:48:45 +03:00
type Reddit struct {
2022-08-04 15:30:25 -03:00
Enabled bool ` yaml:"enabled,omitempty" json:"enabled,omitempty" `
ApplicationID string ` yaml:"application_id,omitempty" json:"application_id,omitempty" `
Username string ` yaml:"username,omitempty" json:"username,omitempty" `
TitleTemplate string ` yaml:"title_template,omitempty" json:"title_template,omitempty" `
URLTemplate string ` yaml:"url_template,omitempty" json:"url_template,omitempty" `
Sub string ` yaml:"sub,omitempty" json:"sub,omitempty" `
2021-08-31 16:48:45 +03:00
}
2021-09-01 22:46:25 +03:00
type Slack struct {
2022-08-04 15:30:25 -03:00
Enabled bool ` yaml:"enabled,omitempty" json:"enabled,omitempty" `
MessageTemplate string ` yaml:"message_template,omitempty" json:"message_template,omitempty" `
Channel string ` yaml:"channel,omitempty" json:"channel,omitempty" `
Username string ` yaml:"username,omitempty" json:"username,omitempty" `
IconEmoji string ` yaml:"icon_emoji,omitempty" json:"icon_emoji,omitempty" `
IconURL string ` yaml:"icon_url,omitempty" json:"icon_url,omitempty" `
Blocks [ ] SlackBlock ` yaml:"blocks,omitempty" json:"blocks,omitempty" `
Attachments [ ] SlackAttachment ` yaml:"attachments,omitempty" json:"attachments,omitempty" `
2021-09-01 22:46:25 +03:00
}
2021-09-11 19:23:54 +02:00
type Discord struct {
2022-08-04 15:30:25 -03:00
Enabled bool ` yaml:"enabled,omitempty" json:"enabled,omitempty" `
MessageTemplate string ` yaml:"message_template,omitempty" json:"message_template,omitempty" `
Author string ` yaml:"author,omitempty" json:"author,omitempty" `
Color string ` yaml:"color,omitempty" json:"color,omitempty" `
IconURL string ` yaml:"icon_url,omitempty" json:"icon_url,omitempty" `
2021-09-11 19:23:54 +02:00
}
2021-09-13 00:57:58 +02:00
type Teams struct {
2022-08-04 15:30:25 -03:00
Enabled bool ` yaml:"enabled,omitempty" json:"enabled,omitempty" `
TitleTemplate string ` yaml:"title_template,omitempty" json:"title_template,omitempty" `
MessageTemplate string ` yaml:"message_template,omitempty" json:"message_template,omitempty" `
Color string ` yaml:"color,omitempty" json:"color,omitempty" `
IconURL string ` yaml:"icon_url,omitempty" json:"icon_url,omitempty" `
2021-09-13 00:57:58 +02:00
}
2021-09-29 01:18:35 +02:00
type Mattermost struct {
2022-08-04 15:30:25 -03:00
Enabled bool ` yaml:"enabled,omitempty" json:"enabled,omitempty" `
MessageTemplate string ` yaml:"message_template,omitempty" json:"message_template,omitempty" `
TitleTemplate string ` yaml:"title_template,omitempty" json:"title_template,omitempty" `
Color string ` yaml:"color,omitempty" json:"color,omitempty" `
Channel string ` yaml:"channel,omitempty" json:"channel,omitempty" `
Username string ` yaml:"username,omitempty" json:"username,omitempty" `
IconEmoji string ` yaml:"icon_emoji,omitempty" json:"icon_emoji,omitempty" `
IconURL string ` yaml:"icon_url,omitempty" json:"icon_url,omitempty" `
2021-09-29 01:18:35 +02:00
}
2021-09-15 21:38:58 +03:00
type SMTP struct {
2022-08-04 15:30:25 -03:00
Enabled bool ` yaml:"enabled,omitempty" json:"enabled,omitempty" `
Host string ` yaml:"host,omitempty" json:"host,omitempty" `
Port int ` yaml:"port,omitempty" json:"port,omitempty" `
Username string ` yaml:"username,omitempty" json:"username,omitempty" `
From string ` yaml:"from,omitempty" json:"from,omitempty" `
To [ ] string ` yaml:"to,omitempty" json:"to,omitempty" `
SubjectTemplate string ` yaml:"subject_template,omitempty" json:"subject_template,omitempty" `
BodyTemplate string ` yaml:"body_template,omitempty" json:"body_template,omitempty" `
InsecureSkipVerify bool ` yaml:"insecure_skip_verify,omitempty" json:"insecure_skip_verify,omitempty" `
2021-09-15 21:38:58 +03:00
}
2021-11-07 03:04:08 +03:00
type LinkedIn struct {
2022-08-04 15:30:25 -03:00
Enabled bool ` yaml:"enabled,omitempty" json:"enabled,omitempty" `
MessageTemplate string ` yaml:"message_template,omitempty" json:"message_template,omitempty" `
2021-11-07 03:04:08 +03:00
}
2021-10-07 15:01:31 +02:00
type Telegram struct {
2022-08-04 15:30:25 -03:00
Enabled bool ` yaml:"enabled,omitempty" json:"enabled,omitempty" `
MessageTemplate string ` yaml:"message_template,omitempty" json:"message_template,omitempty" `
2023-01-07 17:53:40 -03:00
ChatID string ` yaml:"chat_id,omitempty" json:"chat_id,omitempty" jsonschema:"oneof_type=string;integer" `
2021-10-07 15:01:31 +02:00
}
2023-02-09 06:11:47 -06:00
type OpenCollective struct {
Enabled bool ` yaml:"enabled,omitempty" json:"enabled,omitempty" `
Slug string ` yaml:"slug,omitempty" json:"slug,omitempty" `
TitleTemplate string ` yaml:"title_template,omitempty" json:"title_template,omitempty" `
MessageTemplate string ` yaml:"message_template,omitempty" json:"message_template,omitempty" `
}
2020-05-26 00:48:10 -03: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
2020-05-26 00:48:10 -03:00
// LoadReader config via io.Reader.
2017-05-10 19:14:17 -07:00
func LoadReader ( fd io . Reader ) ( config Project , err error ) {
2021-04-25 13:00:51 -03:00
data , err := io . ReadAll ( fd )
2017-05-10 19:14:17 -07:00
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
}
2022-03-30 14:42:59 +02:00
// SlackBlock represents the untyped structure of a rich slack message layout.
type SlackBlock struct {
Internal interface { }
}
// UnmarshalYAML is a custom unmarshaler that unmarshals a YAML slack block as untyped interface{}.
func ( a * SlackBlock ) UnmarshalYAML ( unmarshal func ( interface { } ) error ) error {
var yamlv2 interface { }
if err := unmarshal ( & yamlv2 ) ; err != nil {
return err
}
a . Internal = yamlv2
return nil
}
// MarshalJSON marshals a slack block as JSON.
func ( a SlackBlock ) MarshalJSON ( ) ( [ ] byte , error ) {
return json . Marshal ( a . Internal )
}
// SlackAttachment represents the untyped structure of a slack message attachment.
type SlackAttachment struct {
Internal interface { }
}
// UnmarshalYAML is a custom unmarshaler that unmarshals a YAML slack attachment as untyped interface{}.
func ( a * SlackAttachment ) UnmarshalYAML ( unmarshal func ( interface { } ) error ) error {
var yamlv2 interface { }
if err := unmarshal ( & yamlv2 ) ; err != nil {
return err
}
a . Internal = yamlv2
return nil
}
// MarshalJSON marshals a slack attachment as JSON.
func ( a SlackAttachment ) MarshalJSON ( ) ( [ ] byte , error ) {
return json . Marshal ( a . Internal )
}
feat: chocolatey support (#3509)
This PR adds support for generating the structure used to pack and push
Chocolatey Packages. And will solve the #3154
Is not ready for merge yet, but has the main structure, and ready for
comments.
Accordingly to Chocolatey, in order to build a package, it's necessary a
`.nuspec` and `chocolateyinstall.ps1` files at least, having these ones,
we could pack and distribute without adding the binary inside the final
package and that was implemented here.
To complete, will be necessary to define the package build and
distribute, however will be required to have Chocolatey installed
(Windows Only). One of alternatives that I thought was, publish the
files like Scoop and Brew in a separate repository, and there we could
use `chocolatey` through
[crazy-max/ghaction-chocolatey](https://github.com/crazy-max/ghaction-chocolatey).
Chocolatey has a lot of good examples of repositories:
https://github.com/chocolatey-community/chocolatey-packages/tree/master/automatic/curl
A final compilation of the missing parts:
- [x] How to pack and push (chocolatey)
- [x] Documentation
Sorry for the long description😄
All feedback very welcome!
Co-authored-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2022-11-12 03:52:32 +01:00
// Chocolatey contains the chocolatey section.
type Chocolatey struct {
Name string ` yaml:"name,omitempty" json:"name,omitempty" `
IDs [ ] string ` yaml:"ids,omitempty" json:"ids,omitempty" `
PackageSourceURL string ` yaml:"package_source_url,omitempty" json:"package_source_url,omitempty" `
Owners string ` yaml:"owners,omitempty" json:"authoers,omitempty" `
Title string ` yaml:"title,omitempty" json:"title,omitempty" `
Authors string ` yaml:"authors,omitempty" json:"authors,omitempty" `
ProjectURL string ` yaml:"project_url,omitempty" json:"project_url,omitempty" `
URLTemplate string ` yaml:"url_template,omitempty" json:"url_template,omitempty" `
IconURL string ` yaml:"icon_url,omitempty" json:"icon_url,omitempty" `
Copyright string ` yaml:"copyright,omitempty" json:"copyright,omitempty" `
LicenseURL string ` yaml:"license_url,omitempty" json:"license_url,omitempty" `
RequireLicenseAcceptance bool ` yaml:"require_license_acceptance,omitempty" json:"require_license_acceptance,omitempty" `
ProjectSourceURL string ` yaml:"project_source_url,omitempty" json:"project_source_url,omitempty" `
DocsURL string ` yaml:"docs_url,omitempty" json:"docs_url,omitempty" `
BugTrackerURL string ` yaml:"bug_tracker_url,omitempty" json:"bug_tracker_url,omitempty" `
Tags string ` yaml:"tags,omitempty" json:"tags,omitempty" `
Summary string ` yaml:"summary,omitempty" json:"summary,omitempty" `
Description string ` yaml:"description,omitempty" json:"description,omitempty" `
ReleaseNotes string ` yaml:"release_notes,omitempty" json:"release_notes,omitempty" `
Dependencies [ ] ChocolateyDependency ` yaml:"dependencies,omitempty" json:"dependencies,omitempty" `
SkipPublish bool ` yaml:"skip_publish,omitempty" json:"skip_publish,omitempty" `
APIKey string ` yaml:"api_key,omitempty" json:"api_key,omitempty" `
SourceRepo string ` yaml:"source_repo,omitempty" json:"source_repo,omitempty" `
Goamd64 string ` yaml:"goamd64,omitempty" json:"goamd64,omitempty" `
}
// ChcolateyDependency represents Chocolatey dependency.
type ChocolateyDependency struct {
ID string ` yaml:"id,omitempty" json:"id,omitempty" `
Version string ` yaml:"version,omitempty" json:"version,omitempty" `
}