Documentation ¶
Index ¶
- Variables
- func AddCommandToContext(ctx context.Context, c *cobra.Command) context.Context
- func AddConfigToContext(ctx context.Context, c *Config) context.Context
- func CommandFromContext(ctx context.Context) *cobra.Command
- func GuessLanguageAndToolchain() (string, string)
- func LoadConfig(ctx context.Context) (context.Context, error)
- func Setup() func(cmd *cobra.Command, args []string) error
- type AssetConfig
- type CIConfig
- type Config
- type DockerConfig
- type FilterConfig
- type HomebrewConfig
- type ReleaseConfig
- type RunConfig
- type TemplateFileConfig
- type TransomConfig
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DefaultMonoConfig = &Config{ Language: "mono", Install: &RunConfig{ Enabled: makeBool(false), }, Build: &RunConfig{ Enabled: makeBool(false), }, Test: &RunConfig{ Enabled: makeBool(false), }, Version: &TemplateFileConfig{ Enabled: makeBool(false), }, GitHubAction: &TemplateFileConfig{ Enabled: makeBool(false), }, Homebrew: homebrew, CommitLength: 100, } DefaultDockerConfig = &Config{ Language: "docker", Install: &RunConfig{ Enabled: makeBool(false), }, Build: &RunConfig{ Enabled: makeBool(false), }, Test: &RunConfig{ Enabled: makeBool(false), }, Version: &TemplateFileConfig{ Enabled: makeBool(false), }, GitHubAction: &TemplateFileConfig{ Enabled: makeBool(true), Template: "!docker_action.tmpl", }, Homebrew: homebrew, CommitLength: 100, } DefaultGoConfig = &Config{ Language: "go", Install: &RunConfig{ Enabled: makeBool(true), Name: "Download modules", Command: "go mod download", }, Build: &RunConfig{ Enabled: makeBool(true), Name: "Build", Command: "go build ./...", }, Test: &RunConfig{ Enabled: makeBool(true), Name: "Test", Command: "go test ./...", }, Version: &TemplateFileConfig{ File: "version/version_gen.go", Template: "!version_go.tmpl", }, GitHubAction: &TemplateFileConfig{ Enabled: makeBool(true), Template: "!go_action.tmpl", }, Dockerfile: &TemplateFileConfig{ Template: "!go_dockerfile.tmpl", }, Homebrew: homebrew, CommitLength: 100, } DefaultNpmConfig = &Config{ Language: "node", Toolchain: "npm", Install: &RunConfig{ Enabled: makeBool(true), Name: "Download modules", Command: "npm install", }, Build: &RunConfig{ Enabled: makeBool(true), Name: "Build", Command: "npm run build", }, Test: &RunConfig{ Enabled: makeBool(true), Name: "Test", Command: "npm test", }, Version: &TemplateFileConfig{ File: "package.json", }, GitHubAction: &TemplateFileConfig{ Enabled: makeBool(true), Template: "!node_action.tmpl", }, Dockerfile: &TemplateFileConfig{ Template: "!node_npm_dockerfile.tmpl", }, Homebrew: homebrew, CommitLength: 100, } DefaultYarnConfig = &Config{ Language: "node", Toolchain: "yarn", Install: &RunConfig{ Enabled: makeBool(true), Name: "Download modules", Command: "yarn", }, Build: &RunConfig{ Enabled: makeBool(true), Name: "Build", Command: "yarn run build", }, Test: &RunConfig{ Enabled: makeBool(true), Name: "Test", Command: "yarn test", }, Version: &TemplateFileConfig{ Enabled: makeBool(true), File: "package.json", }, GitHubAction: &TemplateFileConfig{ Enabled: makeBool(true), Template: "!node_action.tmpl", }, Dockerfile: &TemplateFileConfig{ Template: "!node_yarn_dockerfile.tmpl", }, Homebrew: homebrew, CommitLength: 100, } DefaultHelmConfig = &Config{ Language: "helm", Install: &RunConfig{ Enabled: makeBool(false), }, Build: &RunConfig{ Enabled: makeBool(false), }, Test: &RunConfig{ Enabled: makeBool(false), }, Version: &TemplateFileConfig{ Enabled: makeBool(false), }, CommitLength: 100, } DefaultJavaMavenConfig = &Config{ Language: "java", Toolchain: "mvn", Install: &RunConfig{ Enabled: makeBool(true), Name: "Validate", Command: "mvn -B -Dbuild.version=${BUILD_VERSION} clean process-resources", }, Build: &RunConfig{ Enabled: makeBool(true), Name: "Build", Command: "mvn -B -Dbuild.version=${BUILD_VERSION} compile", }, Test: &RunConfig{ Enabled: makeBool(true), Name: "Test", Command: "mvn -B -Dbuild.version=${BUILD_VERSION} test", }, Publish: &RunConfig{ Enabled: makeBool(true), Name: "Publish", Command: "mvn -B -Dbuild.version=${BUILD_VERSION} deploy", }, Version: &TemplateFileConfig{ Enabled: makeBool(false), }, GitHubAction: &TemplateFileConfig{ Enabled: makeBool(true), Template: "!java_mvn_action.tmpl", }, Dockerfile: &TemplateFileConfig{ Template: "!java_mvn_dockerfile.tmpl", }, Homebrew: homebrew, CommitLength: 100, } DefaultScalaSbtConfig = &Config{ Language: "scala", Toolchain: "sbt", Install: &RunConfig{ Enabled: makeBool(true), Name: "Download modules", Command: "sbt install", }, Build: &RunConfig{ Enabled: makeBool(true), Name: "Build", Command: "sbt compile", }, Test: &RunConfig{ Enabled: makeBool(true), Name: "Test", Command: "sbt test", }, Version: &TemplateFileConfig{ Enabled: makeBool(false), }, GitHubAction: &TemplateFileConfig{ Enabled: makeBool(true), Template: "!scala_sbt_action.tmpl", }, Dockerfile: &TemplateFileConfig{ Template: "!scala_sbt_dockerfile.tmpl", }, Homebrew: homebrew, CommitLength: 100, } DefaultPythonConfig = &Config{ Language: "python", Install: &RunConfig{ Enabled: makeBool(true), Name: "Download modules", Command: "pip install .", }, Build: &RunConfig{ Enabled: makeBool(false), }, Test: &RunConfig{ Enabled: makeBool(true), Name: "Run tests", Command: "python -m unittest -v", }, Version: &TemplateFileConfig{ File: "version.py", Template: "!version_py.tmpl", }, GitHubAction: &TemplateFileConfig{ Enabled: makeBool(true), Template: "!python_action.tmpl", }, Dockerfile: &TemplateFileConfig{ Template: "!python_dockerfile.tmpl", }, Homebrew: homebrew, CommitLength: 100, } )
Default configurations
Functions ¶
func AddCommandToContext ¶
func LoadConfig ¶
LoadConfig loads config from the configuration file
Types ¶
type AssetConfig ¶
type AssetConfig struct { Enabled *bool `json:"enabled,omitempty" yaml:"enabled,omitempty"` Branches *FilterConfig `json:"branches,omitempty" yaml:"branches,omitempty"` Tags *FilterConfig `json:"tags,omitempty" yaml:"tags,omitempty"` Filename string `json:"filename,omitempty" yaml:"filename,omitempty"` Directory string `json:"directory,omitempty" yaml:"directory,omitempty"` Package string `json:"package,omitempty" yaml:"package,omitempty"` Variable string `json:"variable,omitempty" yaml:"variable,omitempty"` Tag string `json:"tag,omitempty" yaml:"tag,omitempty"` Only []string `json:"only,omitempty" yaml:"only,omitempty"` Except []string `json:"except,omitempty" yaml:"except,omitempty"` }
AssetConfig provides config for asset generate
func (*AssetConfig) IsEnabled ¶
func (c *AssetConfig) IsEnabled() bool
type CIConfig ¶
type CIConfig struct { Enabled *bool `json:"enabled,omitempty" yaml:"enabled,omitempty"` Branches *FilterConfig `json:"branches,omitempty" yaml:"branches,omitempty"` Tags *FilterConfig `json:"tags,omitempty" yaml:"tags,omitempty"` }
CIConfig provides config for CI
type Config ¶
type Config struct { Filename string `json:"filename,omitempty" yaml:"filename,omitempty"` BasePath string `json:"base,omitempty" yaml:"base,omitempty"` Name string `json:"name,omitempty" yaml:"name,omitempty"` Description string `json:"description,omitempty" yaml:"description,omitempty"` Repository string `json:"repository,omitempty" yaml:"repository,omitempty"` Local bool `json:"local,omitempty" yaml:"local,omitempty"` CommitLength int `json:"commit_length,omitempty" yaml:"commit_length,omitempty"` Prerelease string `json:"prerelease,omitempty" yaml:"prerelease,omitempty"` Verbose bool `json:"verbose,omitempty" yaml:"verbose,omitempty"` Quiet bool `json:"quiet,omitempty" yaml:"quiet,omitempty"` Mono bool `json:"mono,omitempty" yaml:"mono,omitempty"` MonoDepth int `json:"mono_depth,omitempty" yaml:"mono_depth,omitempty"` Parallelism int `json:"arallelism,omitempty" yaml:"parallelism,omitempty"` Language string `json:"language,omitempty" yaml:"language,omitempty"` Toolchain string `json:"toolchain,omitempty" yaml:"toolchain,omitempty"` CI *CIConfig `json:"ci,omitempty" yaml:"ci,omitempty"` BeforeInstall *RunConfig `json:"before_install,omitempty" yaml:"before_install,omitempty"` Install *RunConfig `json:"install,omitempty" yaml:"install,omitempty"` AfterInstall *RunConfig `json:"after_install,omitempty" yaml:"after_install,omitempty"` BeforeBuild *RunConfig `json:"before_build,omitempty" yaml:"before_build,omitempty"` Build *RunConfig `json:"build,omitempty" yaml:"build,omitempty"` AfterBuild *RunConfig `json:"after_build,omitempty" yaml:"after_build,omitempty"` BeforeTest *RunConfig `json:"before_test,omitempty" yaml:"before_test,omitempty"` Test *RunConfig `json:"test,omitempty" yaml:"test,omitempty"` AfterTest *RunConfig `json:"after_test,omitempty" yaml:"after_test,omitempty"` Changelog *TemplateFileConfig `json:"changelog,omitempty" yaml:"changelog,omitempty"` BeforeVersion *RunConfig `json:"before_version,omitempty" yaml:"before_version,omitempty"` Version *TemplateFileConfig `json:"version,omitempty" yaml:"version,omitempty"` Versions []*TemplateFileConfig `json:"versions,omitempty" yaml:"versions,omitempty"` AfterVersion *RunConfig `json:"after_version,omitempty" yaml:"after_version,omitempty"` GitHubAction *TemplateFileConfig `json:"githubaction,omitempty" yaml:"githubaction,omitempty"` Dockerfile *TemplateFileConfig `json:"dockerfile,omitempty" yaml:"dockerfile,omitempty"` Dockerfiles []*TemplateFileConfig `json:"dockerfiles,omitempty" yaml:"dockerfiles,omitempty"` Homebrew *HomebrewConfig `json:"homebrew,omitempty" yaml:"homebrew,omitempty"` Transom *TransomConfig `json:"transom,omitempty" yaml:"transom,omitempty"` Docker *DockerConfig `json:"docker,omitempty" yaml:"docker,omitempty"` Dockers []*DockerConfig `json:"dockers,omitempty" yaml:"dockers,omitempty"` Assets []*AssetConfig `json:"assets,omitempty" yaml:"assets,omitempty"` BeforeRelease *RunConfig `json:"before_release,omitempty" yaml:"before_release,omitempty"` Release *ReleaseConfig `json:"release,omitempty" yaml:"release,omitempty"` AfterRelease *RunConfig `json:"after_release,omitempty" yaml:"after_release,omitempty"` BeforePublish *RunConfig `json:"before_publish,omitempty" yaml:"before_publish,omitempty"` Publish *RunConfig `json:"publish,omitempty" yaml:"publish,omitempty"` AfterPublish *RunConfig `json:"after_publish,omitempty" yaml:"after_publish,omitempty"` Environment map[string]string `json:"environment,omitempty" yaml:"environment,omitempty"` Environments map[string]map[string]string `json:"environments,omitempty" yaml:"environments,omitempty"` Scopes []string `json:"scopes,omitempty" yaml:"scopes,omitempty"` Artifacts []string `json:"artifacts,omitempty" yaml:"artifacts,omitempty"` }
Config provides overall configuration
func ConfigFromContext ¶
type DockerConfig ¶
type DockerConfig struct { Enabled *bool `json:"enabled,omitempty" yaml:"enabled,omitempty"` Server string `json:"server,omitempty" yaml:"server,omitempty"` Organization string `json:"organization,omitempty" yaml:"organization,omitempty"` Repository string `json:"repository,omitempty" yaml:"repository,omitempty"` Username string `json:"username,omitempty" yaml:"username,omitempty"` Password string `json:"password,omitempty" yaml:"password,omitempty"` Dockerfile string `json:"dockerfile,omitempty" yaml:"dockerfile,omitempty"` Context string `json:"context,omitempty" yaml:"context,omitempty"` Tag string `json:"tag,omitempty" yaml:"tag,omitempty"` Target string `json:"target,omitempty" yaml:"target,omitempty"` Platforms []string `json:"platforms,omitempty" yaml:"platforms,omitempty"` Scan *bool `json:"scan,omitempty" yaml:"scan,omitempty"` BuildArgs map[string]*string `json:"buildargs,omitempty" yaml:"buildargs,omitempty"` Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"` Branches *FilterConfig `json:"branches,omitempty" yaml:"branches,omitempty"` Tags *FilterConfig `json:"tags,omitempty" yaml:"tags,omitempty"` }
DockerConfig provides config for Docker
func (*DockerConfig) IsEnabled ¶
func (d *DockerConfig) IsEnabled() bool
type FilterConfig ¶
type FilterConfig struct { Ignore string `json:"ignore,omitempty" yaml:"ignore,omitempty"` Only string `json:"only,omitempty" yaml:"only,omitempty"` }
FilterConfig provides config for filters
func (*FilterConfig) IsEnabled ¶
func (c *FilterConfig) IsEnabled() bool
type HomebrewConfig ¶
type HomebrewConfig struct { Enabled *bool `json:"enabled,omitempty" yaml:"enabled,omitempty"` Organization string `json:"organization,omitempty" yaml:"organization,omitempty"` Repository string `json:"repository,omitempty" yaml:"repository,omitempty"` Template string `json:"template,omitempty" yaml:"template,omitempty"` File string `json:"file,omitempty" yaml:"file,omitempty"` Url string `json:"url,omitempty" yaml:"url,omitempty"` Asset string `json:"asset,omitempty" yaml:"asset,omitempty"` Install string `json:"install,omitempty" yaml:"install,omitempty"` Test string `json:"test,omitempty" yaml:"test,omitempty"` DependsOn []string `json:"depends_on,omitempty" yaml:"depends_on,omitempty"` Variables map[string]any `json:"variables,omitempty" yaml:"variables,omitempty"` Branches *FilterConfig `json:"branches,omitempty" yaml:"branches,omitempty"` Tags *FilterConfig `json:"tags,omitempty" yaml:"tags,omitempty"` }
HomebrewConfig provides config for Homebrew
func (*HomebrewConfig) GetFile ¶
func (c *HomebrewConfig) GetFile() string
func (*HomebrewConfig) GetTemplate ¶
func (c *HomebrewConfig) GetTemplate() string
func (*HomebrewConfig) IsEnabled ¶
func (c *HomebrewConfig) IsEnabled() bool
type ReleaseConfig ¶
type ReleaseConfig struct { Enabled *bool `json:"enabled,omitempty" yaml:"enabled,omitempty"` Name string `json:"name,omitempty" yaml:"name,omitempty"` Command string `json:"command,omitempty" yaml:"command,omitempty"` Environment map[string]string `json:"environment,omitempty" yaml:"environment,omitempty"` Branches *FilterConfig `json:"branches,omitempty" yaml:"branches,omitempty"` Tags *FilterConfig `json:"tags,omitempty" yaml:"tags,omitempty"` Input string `json:"input,omitempty" yaml:"input,omitempty"` Artifacts []string `json:"artifacts,omitempty" yaml:"artifacts,omitempty"` }
ReleaseConfig provides config for releases
func (*ReleaseConfig) IsEnabled ¶
func (c *ReleaseConfig) IsEnabled() bool
func (*ReleaseConfig) RunConfig ¶
func (c *ReleaseConfig) RunConfig() *RunConfig
type RunConfig ¶
type RunConfig struct { Enabled *bool `json:"enabled,omitempty" yaml:"enabled,omitempty"` Name string `json:"name,omitempty" yaml:"name,omitempty"` Command string `json:"command,omitempty" yaml:"command,omitempty"` Environment map[string]string `json:"environment,omitempty" yaml:"environment,omitempty"` Branches *FilterConfig `json:"branches,omitempty" yaml:"branches,omitempty"` Tags *FilterConfig `json:"tags,omitempty" yaml:"tags,omitempty"` Input string `json:"input,omitempty" yaml:"input,omitempty"` }
RunConfig provides config for commands to run
type TemplateFileConfig ¶
type TemplateFileConfig struct { Enabled *bool `json:"enabled,omitempty" yaml:"enabled,omitempty"` Template string `json:"template,omitempty" yaml:"template,omitempty"` File string `json:"file,omitempty" yaml:"file,omitempty"` Variables map[string]string `json:"variables,omitempty" yaml:"variables,omitempty"` }
TemplateFileConfig provides config for files produced from templates
func (TemplateFileConfig) GetFile ¶
func (c TemplateFileConfig) GetFile() string
func (TemplateFileConfig) GetTemplate ¶
func (c TemplateFileConfig) GetTemplate() string
func (TemplateFileConfig) GetVariables ¶
func (c TemplateFileConfig) GetVariables() map[string]string
func (*TemplateFileConfig) IsEnabled ¶
func (c *TemplateFileConfig) IsEnabled() bool
type TransomConfig ¶
type TransomConfig struct { Enabled *bool `json:"enabled,omitempty" yaml:"enabled,omitempty"` Server string `json:"server,omitempty" yaml:"server,omitempty"` Organization string `json:"organization,omitempty" yaml:"organization,omitempty"` Application string `json:"application,omitempty" yaml:"application,omitempty"` Token string `json:"token,omitempty" yaml:"token,omitempty"` Branches *FilterConfig `json:"branches,omitempty" yaml:"branches,omitempty"` Tags *FilterConfig `json:"tags,omitempty" yaml:"tags,omitempty"` Directory string `json:"directory,omitempty" yaml:"directory,omitempty"` Artifacts []string `json:"artifacts,omitempty" yaml:"artifacts,omitempty"` }
TransomConfig provides configuration for Transom
func (*TransomConfig) IsEnabled ¶
func (d *TransomConfig) IsEnabled() bool
Click to show internal directories.
Click to hide internal directories.