config

package
v0.56.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 12, 2022 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadEnvFile

func LoadEnvFile(filename string) (map[string]string, error)

LoadEnvFile loads environment variables from text file on the form key=value. It ignores empty lines and lines starting with # and lines without an equals sign.

Types

type Archive

type Archive struct {
	// Glob of Build paths to archive. Multiple paths will be ANDed.
	Paths           []string        `toml:"paths"`
	ArchiveSettings ArchiveSettings `toml:"archive_settings"`

	PathsCompiled matchers.Matcher `toml:"-"`
	ArchsCompiled []BuildArchPath  `toml:"-"`
}

func (*Archive) Init

func (a *Archive) Init() error

type ArchiveFileInfo added in v0.53.0

type ArchiveFileInfo struct {
	SourcePath string      `toml:"source_path"`
	TargetPath string      `toml:"target_path"`
	Mode       fs.FileMode `toml:"mode"`
}

type ArchiveSettings

type ArchiveSettings struct {
	Type ArchiveType `toml:"type"`

	BinaryDir    string            `toml:"binary_dir"`
	NameTemplate string            `toml:"name_template"`
	ExtraFiles   []ArchiveFileInfo `toml:"extra_files"`
	Replacements map[string]string `toml:"replacements"`
	Plugin       Plugin            `toml:"plugin"`

	// CustomSettings is archive type specific metadata.
	// See in the documentation for the configured archive type.
	CustomSettings map[string]any `toml:"custom_settings"`

	ReplacementsCompiled *strings.Replacer `toml:"-"`
}

func (*ArchiveSettings) Init

func (a *ArchiveSettings) Init() error

type ArchiveType

type ArchiveType struct {
	Format    string `toml:"format"`
	Extension string `toml:"extension"`

	FormatParsed archiveformats.Format `toml:"-"`
}

func (*ArchiveType) Init

func (a *ArchiveType) Init() error

func (ArchiveType) IsZero

func (a ArchiveType) IsZero() bool

IsZero is needed to get the shallow merge correct.

type Archives

type Archives []Archive

type Build

type Build struct {
	Path string    `toml:"path"`
	Os   []BuildOs `toml:"os"`

	BuildSettings BuildSettings `toml:"build_settings"`
}

func (*Build) Init

func (b *Build) Init() error

func (Build) IsZero

func (b Build) IsZero() bool

type BuildArch

type BuildArch struct {
	Goarch string `toml:"goarch"`

	BuildSettings BuildSettings `toml:"build_settings"`

	// Tree navigation.
	Build *Build   `toml:"-"`
	Os    *BuildOs `toml:"-"`
}

func (BuildArch) BinaryPath

func (b BuildArch) BinaryPath() string

BinaryPath returns the path to the built binary starting below /builds.

type BuildArchPath

type BuildArchPath struct {
	Arch BuildArch `toml:"arch"`
	Path string    `toml:"path"`

	// Name is the name of the archive with the extension.
	Name string `toml:"name"`

	// Any archive aliase names, with the extension.
	Aliases []string `toml:"aliases"`
}

type BuildOs

type BuildOs struct {
	Goos  string      `toml:"goos"`
	Archs []BuildArch `toml:"archs"`

	BuildSettings BuildSettings `toml:"build_settings"`

	// Tree navigation.
	Build *Build `toml:"-"`
}

type BuildSettings

type BuildSettings struct {
	Binary string `toml:"binary"`

	Env     []string `toml:"env"`
	Ldflags string   `toml:"ldflags"`
	Flags   []string `toml:"flags"`

	GoSettings GoSettings `toml:"go_settings"`
}

func (BuildSettings) Fields

func (b BuildSettings) Fields() logg.Fields

Fields is used by the logging framework.

type Builds

type Builds []Build

type Config

type Config struct {
	Project                  string            `toml:"project"`
	ArchiveAliasReplacements map[string]string `toml:"archive_alias_replacements"`

	GoSettings GoSettings `toml:"go_settings"`

	Builds   Builds   `toml:"builds"`
	Archives Archives `toml:"archives"`
	Releases Releases `toml:"releases"`

	BuildSettings   BuildSettings   `toml:"build_settings"`
	ArchiveSettings ArchiveSettings `toml:"archive_settings"`
	ReleaseSettings ReleaseSettings `toml:"release_settings"`
}

func DecodeAndApplyDefaults

func DecodeAndApplyDefaults(r io.Reader) (Config, error)

DecodeAndApplyDefaults first expand any environment variables in r (${var}), decodes it and applies default values.

func (Config) FindArchs

func (c Config) FindArchs(filter matchers.Matcher) []BuildArchPath

FindArchs returns the archs that match the given filter

func (Config) FindReleases

func (c Config) FindReleases(filter matchers.Matcher) []Release

type GoSettings

type GoSettings struct {
	GoExe   string `toml:"go_exe"`
	GoProxy string `toml:"go_proxy"`
}

type Plugin

type Plugin struct {
	ID      string   `toml:"id"`
	Type    string   `toml:"type"`
	Command string   `toml:"command"`
	Dir     string   `toml:"dir"`
	Env     []string `toml:"env"`

	TypeParsed plugintypes.Type `toml:"-"`
}

func (*Plugin) Clear

func (t *Plugin) Clear()

func (*Plugin) Init

func (t *Plugin) Init() error

func (Plugin) IsZero

func (t Plugin) IsZero() bool

type Release

type Release struct {
	// Paths with Glob of releases paths to release. Multiple paths will be ANDed.
	Paths []string `toml:"paths"`

	// Path is the directory below /dist/releases where the release artifacts gets stored.
	// This must be unique for each release within one configuration file.
	Path string `toml:"path"`

	ReleaseSettings ReleaseSettings `toml:"release_settings"`

	PathsCompiled matchers.Matcher `toml:"-"`

	// Builds matching Paths.
	ArchsCompiled []BuildArchPath `toml:"-"`
}

func (*Release) Init

func (a *Release) Init() error

type ReleaseNotesGroup added in v0.9.0

type ReleaseNotesGroup struct {
	Title   string `toml:"title"`
	Regexp  string `toml:"regexp"`
	Ignore  bool   `toml:"ignore"`
	Ordinal int    `toml:"ordinal"`

	RegexpCompiled matchers.Matcher `toml:"-"`
}

func (*ReleaseNotesGroup) Init added in v0.9.0

func (g *ReleaseNotesGroup) Init() error

type ReleaseNotesSettings added in v0.9.0

type ReleaseNotesSettings struct {
	Generate         bool                `toml:"generate"`
	GenerateOnHost   bool                `toml:"generate_on_host"`
	Filename         string              `toml:"filename"`
	TemplateFilename string              `toml:"template_filename"`
	Groups           []ReleaseNotesGroup `toml:"groups"`

	// Can be used to collapse releases with a few number (less than threshold) of changes into one title.
	ShortThreshold int    `toml:"short_threshold"`
	ShortTitle     string `toml:"short_title"`
}

func (*ReleaseNotesSettings) Init added in v0.9.0

func (g *ReleaseNotesSettings) Init() error

type ReleaseSettings

type ReleaseSettings struct {
	Type string `toml:"type"`

	Name            string `toml:"name"`
	Repository      string `toml:"repository"`
	RepositoryOwner string `toml:"repository_owner"`
	Draft           bool   `toml:"draft"`
	Prerelease      bool   `toml:"prerelease"`

	ReleaseNotesSettings ReleaseNotesSettings `toml:"release_notes_settings"`

	TypeParsed releasetypes.Type `toml:"-"`
}

func (*ReleaseSettings) Init

func (r *ReleaseSettings) Init() error

type Releases

type Releases []Release

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL