release

package
v0.14.0-dryrun.50 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCommand

func NewCommand() *cobra.Command

NewCommand creates the manage-release command

Types

type Action

type Action string

Action represents the release management action to perform

const (
	ActionCreate     Action = "create"
	ActionUpdate     Action = "update"
	ActionLock       Action = "lock"
	ActionPrerelease Action = "prerelease"
	ActionPublish    Action = "publish"
	ActionDelete     Action = "delete"
)

func ValidateAction

func ValidateAction(action string) (Action, error)

ValidateAction checks if the action is valid

type GitHubRelease

type GitHubRelease struct {
	ID              int64  `json:"id"`
	TagName         string `json:"tag_name"`
	TargetCommitish string `json:"target_commitish"`
	Name            string `json:"name"`
	Body            string `json:"body"`
	Draft           bool   `json:"draft"`
	Prerelease      bool   `json:"prerelease"`
	URL             string `json:"url"`
	HTMLURL         string `json:"html_url"`
}

GitHubRelease represents a GitHub release

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager handles GitHub release operations

func NewManager

func NewManager(repo, token string, opts ...Option) *Manager

NewManager creates a new release manager. It respects GITHUB_API_URL for GitHub Enterprise or test environments.

func NewManagerWithURL

func NewManagerWithURL(repo, token, baseURL string, opts ...Option) *Manager

NewManagerWithURL creates a release manager with a custom API URL. Use this for testing or when GITHUB_API_URL isn't set.

func (*Manager) Manage

func (m *Manager) Manage(opts Options) (*Result, error)

Manage performs the specified release action

type Option added in v0.12.0

type Option func(*Manager)

Option configures a Manager at construction. Options follow the functional options pattern so new per-component capability is additive and never a breaking change to the constructor signature.

func WithTagGrammar added in v0.12.0

func WithTagGrammar(spec taggrammar.Spec) Option

WithTagGrammar scopes the Manager's RC-tag reaper to a component's tag namespace by parsing candidate tags through spec instead of the historical permissive matcher. spec is expected to be a strict-prefix grammar (see config.ResolvedComponent.TagGrammarSpec), so a component reaps only its own RC tags and never a sibling component's. Omitting this option keeps the single-component permissive behavior unchanged.

type Options

type Options struct {
	Action      Action
	Environment string
	SHA         string
	Tag         string
	Changelog   string
	PreviousTag string // Tag to compare against for "What's Changed" link
	NewTag      string // New tag for publish (semver) - replaces short-sha tag
	DeleteTag   string // Tag to delete after publish (short-sha cleanup)
	CreateTag   bool   // Whether to create the git tag (for initial release)
	// TagOnly makes create/update materialize the git tag only and skip the
	// draft-release POST. It exists for a self-publishing release pipeline (for
	// example GoReleaser) that is the sole creator of the release object: when a
	// separate release workflow publishes its own release for the same tag, a
	// draft pre-created here would never be reconciled and would orphan. In
	// tag-only mode the tag is still created when CreateTag is set, but no release
	// object is created or mutated, so a published release the release workflow
	// already made is never touched.
	TagOnly bool
	// KnownReleaseID is the GitHub release ID returned by a preceding ActionCreate
	// in the same workflow step. When set, ActionPrerelease and ActionLock use it
	// directly instead of re-discovering the release by tag, eliminating the
	// eventual-consistency window between draft creation and the list endpoint.
	KnownReleaseID int64
	// AllowPublishedDelete permits ActionDelete to remove a non-draft (published
	// or prerelease) release. It exists ONLY for hotfix-rejoin cleanup, where the
	// release is a superseded intermediate artifact: a hotfix on the prerelease
	// env is promoted to a GitHub prerelease (draft:false), so by the time a
	// later promote rejoins the env the hotfix release is non-draft and the
	// general guard would otherwise wedge the cleanup. Normal publish/promote
	// delete paths leave this false so a real published release is still protected.
	AllowPublishedDelete bool
}

Options contains the parameters for release operations

type Result

type Result struct {
	ReleaseID  int64  `json:"release_id"`
	ReleaseURL string `json:"release_url"`
	HTMLURL    string `json:"html_url"`
}

Result contains the output of a release operation

Jump to

Keyboard shortcuts

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