modules

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2022 License: BlueOak-1.0.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvConfigHome = "XDG_CONFIG_HOME"
	EnvHome       = "HOME"
	EnvHomePath   = "HOMEPATH"
)

Variables

View Source
var ErrSkippedTarget = errors.New("target is skipped")

Functions

func NewArtifact

func NewArtifact() modules.Pluggable

NewArtifact is a factory method for Artifact module

func NewChecksum

func NewChecksum() modules.Pluggable

func NewCutChangelog

func NewCutChangelog() modules.Pluggable

func NewEnv

func NewEnv() modules.Pluggable

func NewGit

func NewGit() modules.Pluggable

NewGit is the factory function for Git

func NewGo

func NewGo() modules.Pluggable

NewGo is a Go struct factory

func NewProject

func NewProject() modules.Pluggable

NewProject is the factory function for Project

func NewSCP

func NewSCP() modules.Pluggable

NewSCP is a factory function for SCP module

func NewShow

func NewShow() modules.Pluggable

NewShow returns a new Show module

func NewSkipPublish

func NewSkipPublish() modules.Pluggable

NewSkipPublish is a factory method for SkipPublish plugin

func NewTar

func NewTar() modules.Pluggable

func NewUPX

func NewUPX() modules.Pluggable

func Register

func Register()

Types

type Artifact

type Artifact struct {
	// Builds specifies which build names should be uploaded to the
	// github release.
	Builds []string
	// Name specifies the repository's name. No default, no detection (yet).
	// Required.
	Name string
	// Owner specifies the repository's owning organization. No default,
	// no detection (yet). Required.
	Owner string
	// ReleaseName specifies the release's name, using modules.TemplateData.
	// Default: "{{.Version}}"
	ReleaseName string `yaml:"release_name,omitempty"`
	// ReleaseNotes selects the artifact to be used for release notes.
	// It must select a single artifact.
	ReleaseNotes string `yaml:"release_notes"`
	// SkipTLSVerify allows connecting to servers with invalid TLS certs.
	// default: false
	SkipTLSVerify bool `yaml:"skip_tls_verify"`
	// Service specifies which artifact service we are using. Default: "github".
	Storage *artifacts.Storage
	// TokenEnv specifies which environment variable the module should look
	// for for server token. It is discovered from artifacts.Storage if not set.
	// Example: GITHUB_TOKEN.
	TokenEnv string `yaml:"token_env"`
	// TokenFile specifies which file the module should look for artifact storage
	// token. Variable expansion is available. It is discovered
	// from artifacts.Storage if not set. Example:
	// "$XDG_CONFIG_HOME/goshipdone/github_token".
	TokenFile string `yaml:"token_file"`
	// URL base URL for the artifact storage. Provide this only for on-premises services.
	URL string
}

Artifact is a publish module for artifact storage servers like GitHub, or GitLab.

func (*Artifact) NewClient

func (mod *Artifact) NewClient(cx context.Context) (artifacts.Connection, error)

NewClient returns a new Storage connection

func (*Artifact) Run

func (mod *Artifact) Run(cx context.Context) error

Run uploads previously created artifact into artifact storage provided by artifacts.Storage.

type Checksum

type Checksum struct {
	// Algorithm specifies checksum algorithm
	Algorithm HashAlgorithm
	// Builds specifies a build names to find related artifacts to
	// calculate checksums of.
	Builds []string
	// ID specifies the checksum's name, as it stores in artifacts.
	// Default: "checksum"
	ID string
	// Output is where the checksum file is going to be created
	// Default: "{{.ProjectName}}-{{.Version}}-checksums.txt"
	Output string
	// Skip specifies which os-arch items should be skipped
	Skip []string
}

Checksum calculates checksums of artifacts, and stores them in a checksum file

func (*Checksum) Run

func (checksum *Checksum) Run(cx context.Context) error

type CompressGz

type CompressGz struct{}

CompressGz defines a gzip compression

func (*CompressGz) Extension

func (c *CompressGz) Extension() string

func (*CompressGz) String

func (c *CompressGz) String() string

func (*CompressGz) Writer

func (c *CompressGz) Writer(writer io.Writer) io.WriteCloser

type CompressNONE

type CompressNONE struct{}

CompressNONE defines a flowthrough compression

func (*CompressNONE) Extension

func (c *CompressNONE) Extension() string

func (*CompressNONE) String

func (c *CompressNONE) String() string

func (*CompressNONE) Writer

func (c *CompressNONE) Writer(writer io.Writer) io.WriteCloser

type Compression

type Compression struct {
	Compressor
}

Compression is a YAML representation of a compression format

func (*Compression) UnmarshalYAML

func (c *Compression) UnmarshalYAML(node *yaml.Node) error

UnmarshalYAML detects compression format

type Compressor

type Compressor interface {
	fmt.Stringer
	Extension() string
	Writer(io.Writer) io.WriteCloser
}

Compressor defines compression interface

type CutChangelog

type CutChangelog struct {
	// ID is the artifact ID of the changelog slice other modules will be
	// able to refer to. Default: "changelog".
	ID string
	// Input points to the original changelog file this module can take a
	// slice of. It must be in https://keepachangelog.org/ format. Default:
	// "CHANGELOG.md".
	Input string
	// Output is the filename of the changelog slice under Dist folder.
	// If empty, it will be the same as Input.
	// Default: "".
	Output string
}

func (*CutChangelog) Run

func (mod *CutChangelog) Run(cx context.Context) error

type Env

type Env struct{}

Env module sets up context's Env hash

func (*Env) Run

func (*Env) Run(cx context.Context) error

type Git

type Git struct{}

Git is a module, which takes a git repo, and filling in `Version` information into `ctx.Context`

func (*Git) Run

func (*Git) Run(cx context.Context) error

Run records git tag information into ctx.Context

type Go

type Go struct {
	// After is a list of commands have to be ran after builds.
	// Any errors cancel the task.
	After []string
	// Before is a list of commands have to be ran before builds.
	// Any errors cancel the task.
	Before []string
	// GOOS is a list of all GOOS variations required. It is
	// set to [`windows`, `linux`] by default.
	GOOS []string
	// GOArch is a list of all GOARCH variations required. It is
	// set to [`amd64`] by default.
	GOArch []string
	// GOArm is a list of all GOARM variations required. GOARM=6 is
	// used by default, as golang's internal default. Providing multiple
	// GOArm entries provides multiple builds while in GOOS=linux and
	// GOARCH=arm setting.
	GOArm []int32
	// ID contains the artifact's name used by later stages of the build
	// pipeline. Archives, and Publishes may refer to this name for
	// referencing build results.
	// Default: "default".
	ID string
	// LDFlags is a `modules.TemplateData` template for providing
	// `-ldflags` configuration option to `go build` command.
	// It defaults to `-s -w -X main.version={{.Version}}`.
	LDFlags string
	// Main designates the file / directory where `main` package
	// (as well as `main` function) is defined.
	Main string
	// Output is where the build writes its output. Default:
	// `{{.ProjectName}}{{.Ext}}`
	Output string
	// Skip specifies GOOS-GOArch combinations to be skipped.
	// They are in `{{.Os}}-{{.Arch}}` format.
	//
	// Eg.
	//
	// “`go
	// Go{
	//     GOOS: []string{"linux", "windows"},
	//     GOArch: []string{"amd64", "386"},
	//     Skip: []string{"linux-386"},
	// }
	// “`
	//
	// will run builds for linux-amd64, windows-amd64, and windows-386 only.
	Skip []string
}

Go represents build:go module

func (*Go) Run

func (mod *Go) Run(cx context.Context) error

Run executes a go build step

type HashAlgorithm

type HashAlgorithm struct {
	Algo    string
	Factory func() hash.Hash
}

func NewHashAlgorithm

func NewHashAlgorithm(hasher string) (*HashAlgorithm, error)

func (*HashAlgorithm) String

func (algo *HashAlgorithm) String() string

func (*HashAlgorithm) UnmarshalYAML

func (algo *HashAlgorithm) UnmarshalYAML(node *yaml.Node) error

type Project

type Project struct {
	Name      string
	TargetDir string `yaml:"target"`
}

Project is a module for setting basic project-specific data

func (*Project) Run

func (mod *Project) Run(cx context.Context) error

Run records project's basic information into ctx.Context

type SCP

type SCP struct {
	// Builds specifies which build names should be added to the archive.
	Builds []string
	// Skip specifies GOOS-GOArch combinations to be skipped.
	// They are in `{{.Os}}-{{.Arch}}` format.
	// It filters builds to be included.
	Skip []string
	// Target specifies SCP endpoint as the last parameter of the `scp`
	// command. Example: staticfiles@remoteserver.com:/var/www/default/public
	Target string
}

SCP is a module for uploading artifacts to a remote server via scp

func (*SCP) Run

func (mod *SCP) Run(cx context.Context) error

Run takes specified artifacts, and uploads them to a SSH server

type Show

type Show struct{}

Show is a module for listing all recorded artifacts so far

func (Show) Run

func (Show) Run(cx context.Context) error

Run provides a list of artifacts recorded so far

type SkipPublish

type SkipPublish struct {
	// EnvName specifies which environment variable should be used to
	// signal skipping publish. Default: `SKIP_PUBLISH`, and while it reads
	// what strconv.ParseBool understands, the only reasonable value for this
	// variable is falsey (eg. "false", 0, and similar).
	EnvName string `yaml:"env_name"`
}

SkipPublish module controls whether publish phase should be executed, by reading from an environment variable. This is an automatically loaded extension.

func (*SkipPublish) Run

func (mod *SkipPublish) Run(cx context.Context) error

type Tar

type Tar struct {
	// Builds specifies which build names should be added to the archive.
	Builds []string
	// CommonDir contains a common directory name for all files inside
	// the tar archive. An empty CommonDir skips creating subdirectories.
	// Default: `{{.ProjectName}}-{{.Version}}-{{.OS}}-{{.Arch}}`.
	CommonDir string
	// Compression specifies which compression should be applied to the
	// archive.
	Compression Compression
	// Files contains a list of static files should be added to the
	// archive file. They are interpretered as glob.
	Files []string
	// ID contains the artifact's name used by later stages of the build
	// pipeline. Archives, and Publishes may refer to this name for
	// referencing build results.
	// Default: "archive".
	ID string
	// Output is where the build writes its output. Default:
	// `{{.ProjectName}}-{{.Version}}-{{.OS}}-{{.Arch}}.tar{{.Ext}}`
	// where `{{.Ext}}` contains the compression's default extension
	Output string
	// Skip specifies GOOS-GOArch combinations to be skipped.
	// They are in `{{.Os}}-{{.Arch}}` format.
	// It filters builds to be included.
	Skip []string
}

Tar is a module for building an archive from prior builds

func (*Tar) Run

func (mod *Tar) Run(cx context.Context) error

type UPX

type UPX struct {
	// Builds specifies a build names to find related artifacts to
	// modify.
	Builds []string
	// Skip specifies which os-arch items should be skipped
	Skip []string
}

UPX is a module for compressing executable binaries in a self-extracting format using `upx` tool.

func (*UPX) Run

func (archive *UPX) Run(cx context.Context) error

Run calls upx on built artifacts, changing their artifact types

Jump to

Keyboard shortcuts

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