context

package
v0.6.24 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2025 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package context provides gorelease context which is passed through the pipeline.

The context extends the standard library context and add a few more fields and other things, so pipes can gather data provided by previous pipes without really knowing each other.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action uint8
const (
	ActionNone Action = iota
	ActionBuild
	ActionRelease
)

type Context

type Context struct {
	stdctx.Context
	Action            Action
	Config            config.Project
	Env               Env
	Token             string
	TokenType         TokenType
	Git               GitInfo
	Date              time.Time
	Artifacts         *artifact.Artifacts
	ReleaseURL        string
	ReleaseNotes      string
	ReleaseNotesFile  string
	ReleaseNotesTmpl  string
	ReleaseHeaderFile string
	ReleaseHeaderTmpl string
	ReleaseFooterFile string
	ReleaseFooterTmpl string
	Version           string
	ModulePath        string
	PartialTarget     string
	Snapshot          bool
	FailFast          bool
	Partial           bool
	SingleTarget      bool
	SkipTokenCheck    bool
	Clean             bool
	PreRelease        bool
	Deprecated        bool
	Parallelism       int
	Semver            Semver
	Runtime           Runtime
	Skips             map[string]bool

	NotifiedDeprecations map[string]struct{}
	PluginCtx            map[string]any
}

Context carries along some data through the pipes.

func Wrap

func Wrap(ctx stdctx.Context, config config.Project) *Context

Wrap wraps an existing context.

func WrapWithTimeout

func WrapWithTimeout(parent stdctx.Context, config config.Project, timeout time.Duration) (*Context, stdctx.CancelFunc)

WrapWithTimeout new context with the given timeout.

type Env

type Env map[string]string

Env is the environment variables.

func ToEnv

func ToEnv(env []string) Env

ToEnv converts a list of strings to an Env (aka a map[string]string).

func (Env) Copy

func (e Env) Copy() Env

Copy returns a copy of the environment.

func (Env) Strings

func (e Env) Strings() []string

Strings returns the current environment as a list of strings, suitable for os executions.

type GitInfo

type GitInfo struct {
	Branch      string
	CurrentTag  string
	PreviousTag string
	Commit      string
	ShortCommit string
	FullCommit  string
	FirstCommit string
	CommitDate  time.Time
	URL         string
	Summary     string
	TagSubject  string
	TagContents string
	TagBody     string
	Dirty       bool
}

GitInfo includes tags and diffs used in some point.

type Runtime

type Runtime struct {
	Goos   string
	Goarch string
}

type Semver

type Semver struct {
	Major      uint64
	Minor      uint64
	Patch      uint64
	Prerelease string
}

Semver represents a semantic version.

type TokenType

type TokenType string

TokenType is either github or gitlab.

const (
	// TokenTypeGitHub defines github as type of the token.
	TokenTypeGitHub TokenType = "github"
	// TokenTypeGitLab defines gitlab as type of the token.
	TokenTypeGitLab TokenType = "gitlab"
	// TokenTypeGitea defines gitea as type of the token.
	TokenTypeGitea TokenType = "gitea"
	// TokenTypeKmup defines kmup as type of the token.
	TokenTypeKmup TokenType = "kmup"
)

Jump to

Keyboard shortcuts

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