Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ConfigFileLookupPaths define the filepaths where to look for the releaser config file ConfigFileLookupPaths []string = []string{ "./.releaser", "$HOME/.releaser", "~/.releaser", "/etc/releaser", } // Branch config default values BranchAllowedWithoutTypeDefault bool = true BranchDelimiterDefault string = "-" BranchNameFormatDefault string = "{{if .Type}}{{ .Type }} {{end}}{{ .BranchName }}" BranchTypesDefault []string = []string{"bug", "feature", "fix", "hotfix"} // Commit config default values CommitAllowedWithoutTypeDefault bool = true CommitMessageFormatDefault string = "{{if .Type}}{{ .Type | ToTitle }}: {{end}}{{ .CommitMessage }}" CommitTypesDefault []string = []string{"adjustment", "bug", "feature", "fix", "hotfix"} // Flag config default values FlagRequiredDefault bool = false FlagSkipForBranchDefault bool = false FlagSkipForCommitDefault bool = false FlagSkipForReleaseDefault bool = true // Git config default values GitExecutableDefault string = "git" GitRemoteDefault string = "origin" // Release config default values ReleaseFirstTagDefault string = "v0.0.1" ReleaseNameFormatDefault string = "Release {{ .ReleaseTag }} ({{ .DTYear }}-{{ .DTMonth }}-{{ .DTDay }})" ReleaseDescriptionFormatDefault string = ` ## Changelog {{range .GitCommitLogs -}} * {{ .Message }} {{end}}` ReleaseTargetDefault string = "main" )
Functions ¶
Types ¶
type Branch ¶
type Branch struct {
AllowedWithoutType *bool `mapstructure:"allowed_without_type" yaml:"allowed_without_type" validate:"required"`
Delimiter *string `mapstructure:"delimiter" yaml:"delimiter" validate:"required,len=1"`
NameFormat *string `mapstructure:"name_format" yaml:"name_format" validate:"required"`
Types []string `mapstructure:"types" yaml:"types" validate:"required,unique,dive,lowercase,alphanum"`
}
Branch has git branch specific config settings
func (Branch) GetAllowedWithoutType ¶
GetAllowedWithoutType returns the value of the AllowedWithoutType field if present, else default value
func (Branch) GetDelimiter ¶
GetDelimiter returns the value of the Delimiter field if present, else default value
func (Branch) GetNameFormat ¶
GetNameFormat returns the value of the NameFormat field if present, else default value
type Commit ¶
type Commit struct {
AllowedWithoutType *bool `mapstructure:"allowed_without_type" yaml:"allowed_without_type" validate:"required"`
MessageFormat *string `mapstructure:"message_format" yaml:"message_format" validate:"required"`
Types []string `mapstructure:"types" yaml:"types" validate:"required,unique,dive,alphanum"`
}
Commit has git commit specific config settings
func (Commit) GetAllowedWithoutType ¶
GetAllowedWithoutType returns the value of the AllowedWithoutType field if given, else default value
func (Commit) GetMessageFormat ¶
GetMessageFormat returns the value of the MessageFormat field if given, else default value
type Config ¶
type Config struct {
// Git specific config fields
Git Git `mapstructure:"git" yaml:"git" validate:"required,dive"`
// Branch specific config fields
Branch Branch `mapstructure:"branch" yaml:"branch" validate:"required,dive"`
// Commit specific config fields
Commit Commit `mapstructure:"commit" yaml:"commit" validate:"required,dive"`
// Release specific config fields
Release Release `mapstructure:"release" yaml:"release" validate:"required,dive"`
// Flags specify custom flags for commands
Flags []Flag `mapstructure:"flags" yaml:"flags" validate:"dive"`
}
Config has all the relevant settings
func (Config) GetFlagsForBranch ¶
GetFlagsForBranch returns all entries of the Flags field where SkipForBranch is not true
func (Config) GetFlagsForCommit ¶
GetFlagsForCommit returns all entries of the Flags field where SkipForCommit is not true
func (Config) GetFlagsForRelease ¶
GetFlagsForRelease returns all entries of the Flags field where SkipForRelease is not true
type Flag ¶
type Flag struct {
Name string `mapstructure:"name" yaml:"name" validate:"required,alphanum,lowercase"`
Description *string `mapstructure:"description" yaml:"description"`
Required *bool `mapstructure:"required" yaml:"required"`
Default string `mapstructure:"default" yaml:"default"`
SkipForBranch *bool `mapstructure:"skip_for_branch" yaml:"skip_for_branch"`
SkipForCommit *bool `mapstructure:"skip_for_commit" yaml:"skip_for_commit"`
SkipForRelease *bool `mapstructure:"skip_for_release" yaml:"skip_for_release"`
}
Flag is a custom configured flag which could be used for various commands of releaser
func (Flag) GetDefault ¶
GetDefault returns the value of the Default field
func (Flag) GetDescription ¶
GetDescription returns the value of the Description field if given, else default values
func (Flag) GetRequired ¶
GetRequired returns the value of the Required field if given, else default value
func (Flag) GetSkipForBranch ¶
GetSkipForBranch returns the value of the SkipForBranch field if given, else default value
func (Flag) GetSkipForCommit ¶
GetSkipForCommit returns the value of the SkipForCommit field if given, else default value
func (Flag) GetSkipForRelease ¶
GetkipForRelease returns the value of the SkipForRelease field if given, else default value
type FlagList ¶
type FlagList []Flag
FlagList is a slice of Flag entries with some helpful functions
type Git ¶
type Git struct {
Executable *string `mapstructure:"executable" yaml:"executable" validate:"required,alpha,lowercase"`
Remote *string `mapstructure:"remote" yaml:"remote" validate:"required,alphanum,lowercase"`
}
Git has git specific config settings
func (Git) GetExecutable ¶
GetExecutable returns the value of the Executable field if given, else default value
type Global ¶
type Global struct {
Config `mapstructure:",squash"`
// Projects which are handled by releaser
Projects []Project `mapstructure:"projects" yaml:"projects"`
}
Global is the global config data structure of releaser. This is the actual data structure in the YAML configuration file
func NewGlobal ¶
func NewGlobal() *Global
NewGlobal returns an new instance of Global with default values
func (Global) GetConfigWithPresentProjectValues ¶
GetConfigWithPresentProjectValues creates an instance of Config and assigns values of the Project instance to it if present Non-nil project param must be part of the Projects field.
func (Global) GetProjectConfigByPath ¶
func (g Global) GetProjectConfigByPath(path string, textTemplateValues *data.TextTemplateValues) (*Project, error)
GetProjectConfigByPath checks and returns if any of the configured entries in the Projects field matches with the specified path
type Project ¶
type Project struct {
Config `mapstructure:",squash"`
// Paths of the system to which these config settings should apply to. Supports wildcards
Paths []string `mapstructure:"paths" yaml:"paths"`
}
Project is the project (path) specific config data structure
func (Project) MatchesWithPath ¶
func (p Project) MatchesWithPath(pp string, textTemplateValues *data.TextTemplateValues) (bool, error)
MatchesWithPath checks if a given path string matches with the configured Path field
type Release ¶
type Release struct {
DescriptionFormat *string `mapstructure:"description_format" yaml:"description_format" validate:"required"`
NameFormat *string `mapstructure:"name_format" yaml:"name_format" validate:"required"`
FirstTag *string `mapstructure:"first_tag" yaml:"first_tag" validate:"required"`
Target *string `mapstructure:"target" yaml:"target" validate:"required"`
Upstreams map[string]ReleaseUpstream `mapstructure:"upstreams" yaml:"upstreams"`
}
Release has release specific config settings
func (Release) GetDescriptionFormat ¶
GetDescriptionFormat returns the value of the DescriptionFormat field if given, else default value
func (Release) GetFirstTag ¶
GetFirstTag returns the value of the FirstTag field if given, else default value
func (Release) GetNameFormat ¶
GetNameFormat returns the value of the NameFormat field if given, else default value
func (Release) GetTarget ¶
GetTarget returns the value of the Target field if given, else default value
func (Release) GetUpstreams ¶
func (r Release) GetUpstreams() map[string]ReleaseUpstream
GetUpstreams returns the value of the Upstreams field
type ReleaseUpstream ¶
type ReleaseUpstream struct {
APITokenEnvVar *string `mapstructure:"api_token_env_var" yaml:"api_token_env_var"`
}
ReleaseUpstream has release upstream specific config settings
func (ReleaseUpstream) GetAPITokenEnvVar ¶
func (r ReleaseUpstream) GetAPITokenEnvVar(name string) string
GetAPITokenEnvVar returns the value of the APITokenEnvVar field if given, else default value