release

package
v0.21.4 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package release implements the `release` verb: create the release object for a tag that already exists.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrTagRequired reports a run with no --tag. There is no default: the
	// tag is the whole input, and guessing one would release the wrong thing.
	ErrTagRequired = errors.New("release: --tag is required")

	// ErrAssetsMisconfigured reports --assets without --asset-base or the
	// reverse. Half-honouring it would publish a release with no assets, which
	// is the outcome the pair exists to prevent.
	ErrAssetsMisconfigured = errors.New("release: assets are misconfigured")

	// ErrUnknownForge reports a remote colophon cannot map to a provider.
	ErrUnknownForge = errors.New("release: unknown forge")
)

Functions

func DraftPublisherFrom added in v0.9.0

func DraftPublisherFrom(provider forge.Provider) release.DraftPublisher

DraftPublisherFrom discovers the capability that finishes a release left unpublished. Nil where the forge models no draft — GitLab and Bitbucket — and the step is then skipped entirely (spec 0014 D5). Shared with `publish`.

func NewCmdRelease

func NewCmdRelease(props *props.Props) *setup.Command

func ReleasePublishersFrom

func ReleasePublishersFrom(provider forge.Provider) (release.Publisher, release.AssetPublisher)

ReleasePublishersFrom discovers the release capabilities a provider offers. Either may be nil: no release object at all, or releases without the guarantee of publishing one complete. Shared with `publish`.

func ResolveAssets

func ResolveAssets(
	ctx context.Context, dist, base string, named []string, verify ...artifacts.VerifyOption,
) ([]forge.ReleaseAssetSource, error)

ResolveAssets works out what a release should carry and proves each item is where it will be published as living, under base.

The names come from one of two places (spec 0017 D2): goreleaser's manifest under dist, or `assets` in the project's manifest for a project no build tool describes. Naming both is refused rather than merged — a union would leave somebody wondering which source a missing asset should have come from.

Only `release` attaches assets; `publish` lost its asset flags when spec 0005 D7 completed (colophon#36).

The resolve check is here and not in the forge because go/forge records a location without fetching it, deliberately: its guarantee is that no observer sees a release before its assets are attached, not that the assets are real.

Nothing named at all means no assets and is not an error. A source without a base is, because it would silently publish a release with no assets.

func Run

func Run(ctx context.Context, p *props.Props, opts *ReleaseOptions, w io.Writer) error

Run is RunRelease with its output injected.

func RunRelease

func RunRelease(ctx context.Context, p *props.Props, opts *ReleaseOptions, _ []string) error

RunRelease is the `release` verb.

Types

type Options

type Options struct {
	Repo   string
	Target string
	Remote string
	Tag    string

	// Forge names the forge when the remote's host does not (spec 0009 D8).
	Forge string

	// Dist is goreleaser's output directory; AssetBase is where its artefacts
	// were uploaded. Both or neither.
	Dist      string
	AssetBase string
}

Options are the command's inputs.

type Prepared

type Prepared struct {
	Request release.Request
	Forge   remote.Remote

	// Assets are the files the manifest names, for a project whose artefacts
	// no build tool describes (spec 0017). Empty means goreleaser's manifest
	// is consulted instead.
	Assets []string

	// Root and Settings are what the announcement after the release needs
	// (spec 0026 D1).
	Root     string
	Settings manifest.Manifest
}

Prepared is everything `release` resolved before touching a forge.

func Build

func Build(opts Options) (Prepared, error)

Build assembles the request from a repository, without touching a forge.

No hold is read. A hold stops `publish` deciding to release; by the time a tag exists the decision has been made, by publish or by a person. The manifest is read for `forge` alone (spec 0009 D4).

type ReleaseOptions

type ReleaseOptions struct {
	Repo                string
	Tag                 string
	Target              string
	Remote              string
	Forge               string
	Assets              string
	AssetBase           string
	NoAnnounce          bool
	AnnounceFailureExit int
}

Jump to

Keyboard shortcuts

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