artifact

package
v0.182.0 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package artifact provides the core artifact storage for goreleaser.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Artifact

type Artifact struct {
	Name   string
	Path   string
	Goos   string
	Goarch string
	Goarm  string
	Gomips string
	Type   Type
	Extra  map[string]interface{}
}

Artifact represents an artifact and its relevant info.

func (Artifact) Checksum added in v0.84.0

func (a Artifact) Checksum(algorithm string) (string, error)

Checksum calculates the checksum of the artifact. nolint: gosec

func (Artifact) ExtraOr added in v0.160.0

func (a Artifact) ExtraOr(key string, or interface{}) interface{}

ExtraOr returns the Extra field with the given key or the or value specified if it is nil.

type Artifacts

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

Artifacts is a list of artifacts.

func New

func New() Artifacts

New return a new list of artifacts.

func (*Artifacts) Add

func (artifacts *Artifacts) Add(a *Artifact)

Add safely adds a new artifact to an artifact list.

func (*Artifacts) Filter

func (artifacts *Artifacts) Filter(filter Filter) Artifacts

Filter filters the artifact list, returning a new instance. There are some pre-defined filters but anything of the Type Filter is accepted. You can compose filters by using the And and Or filters.

func (Artifacts) GroupByPlatform

func (artifacts Artifacts) GroupByPlatform() map[string][]*Artifact

GroupByPlatform groups the artifacts by their platform.

func (Artifacts) List

func (artifacts Artifacts) List() []*Artifact

List return the actual list of artifacts.

type Filter

type Filter func(a *Artifact) bool

Filter defines an artifact filter which can be used within the Filter function.

func And

func And(filters ...Filter) Filter

And performs an AND between all given filters.

func ByFormats added in v0.160.0

func ByFormats(formats ...string) Filter

ByFormats filters artifacts by a `Format` extra field.

func ByGoarch

func ByGoarch(s string) Filter

ByGoarch is a predefined filter that filters by the given goarch.

func ByGoarm

func ByGoarm(s string) Filter

ByGoarm is a predefined filter that filters by the given goarm.

func ByGoos

func ByGoos(s string) Filter

ByGoos is a predefined filter that filters by the given goos.

func ByIDs added in v0.160.0

func ByIDs(ids ...string) Filter

ByIDs filter artifacts by an `ID` extra field.

func ByType

func ByType(t Type) Filter

ByType is a predefined filter that filters by the given type.

func Or

func Or(filters ...Filter) Filter

Or performs an OR between all given filters.

type Type

type Type int

Type defines the type of an artifact.

const (
	// UploadableArchive a tar.gz/zip archive to be uploaded.
	UploadableArchive Type = iota
	// UploadableBinary is a binary file to be uploaded.
	UploadableBinary
	// UploadableFile is any file that can be uploaded.
	UploadableFile
	// Binary is a binary (output of a gobuild).
	Binary
	// LinuxPackage is a linux package generated by nfpm.
	LinuxPackage
	// PublishableSnapcraft is a snap package yet to be published.
	PublishableSnapcraft
	// Snapcraft is a published snap package.
	Snapcraft
	// PublishableDockerImage is a Docker image yet to be published.
	PublishableDockerImage
	// DockerImage is a published Docker image.
	DockerImage
	// DockerManifest is a published Docker manifest.
	DockerManifest
	// Checksum is a checksums file.
	Checksum
	// Signature is a signature file.
	Signature
	// UploadableSourceArchive is the archive with the current commit source code.
	UploadableSourceArchive
)

func (Type) String added in v0.87.0

func (t Type) String() string

Jump to

Keyboard shortcuts

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