Documentation ¶
Overview ¶
Package artifact provides the core artifact storage for goreleaser.
Index ¶
- Constants
- func Extra[T any](a Artifact, key string) (T, error)
- func ExtraOr[T any](a Artifact, key string, or T) T
- func OnlyReplacingUnibins(a *Artifact) bool
- type Artifact
- type Artifacts
- func (artifacts *Artifacts) Add(a *Artifact)
- func (artifacts *Artifacts) Filter(filter Filter) Artifacts
- func (artifacts Artifacts) GroupByID() map[string][]*Artifact
- func (artifacts Artifacts) GroupByPlatform() map[string][]*Artifact
- func (artifacts Artifacts) List() []*Artifact
- func (artifacts Artifacts) Paths() []string
- func (artifacts *Artifacts) Remove(filter Filter) error
- func (artifacts Artifacts) Visit(fn VisitFn) error
- type Extras
- type Filter
- func And(filters ...Filter) Filter
- func ByBinaryLikeArtifacts(arts Artifacts) Filter
- func ByExt(exts ...string) Filter
- func ByFormats(formats ...string) Filter
- func ByGoamd64(s string) Filter
- func ByGoarch(s string) Filter
- func ByGoarm(s string) Filter
- func ByGoos(s string) Filter
- func ByIDs(ids ...string) Filter
- func ByType(t Type) Filter
- func Or(filters ...Filter) Filter
- type Type
- type VisitFn
Constants ¶
const ( ExtraID = "ID" ExtraBinary = "Binary" ExtraExt = "Ext" ExtraBuilds = "Builds" ExtraFormat = "Format" ExtraWrappedIn = "WrappedIn" ExtraBinaries = "Binaries" ExtraRefresh = "Refresh" ExtraReplaces = "Replaces" )
Variables ¶
This section is empty.
Functions ¶
func Extra ¶
Extra tries to get the extra field with the given name, returning either its value, the default value for its type, or an error.
If the extra value cannot be cast into the given type, it'll try to convert it to JSON and unmarshal it into the correct type after.
If that fails as well, it'll error.
func ExtraOr ¶
ExtraOr returns the Extra field with the given key or the or value specified if it is nil.
func OnlyReplacingUnibins ¶
OnlyReplacingUnibins removes universal binaries that did not replace the single-arch ones.
This is useful specially on homebrew et al, where you'll want to use only either the single-arch or the universal binaries.
Types ¶
type Artifact ¶
type Artifact struct { Name string `json:"name,omitempty"` Path string `json:"path,omitempty"` Goos string `json:"goos,omitempty"` Goarch string `json:"goarch,omitempty"` Goarm string `json:"goarm,omitempty"` Gomips string `json:"gomips,omitempty"` Goamd64 string `json:"goamd64,omitempty"` Type Type `json:"internal_type,omitempty"` TypeS string `json:"type,omitempty"` Extra Extras `json:"extra,omitempty"` }
Artifact represents an artifact and its relevant info.
type Artifacts ¶
type Artifacts struct {
// contains filtered or unexported fields
}
Artifacts is a list of artifacts.
func (*Artifacts) Filter ¶
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 ¶
GroupByPlatform groups the artifacts by their platform.
type Filter ¶
Filter defines an artifact filter which can be used within the Filter function.
func ByBinaryLikeArtifacts ¶
ByBinaryLikeArtifacts filter artifacts down to artifacts that are Binary, UploadableBinary, or UniversalBinary, deduplicating artifacts by path (preferring UploadableBinary over all others). Note: this filter is unique in the sense that it cannot act in isolation of the state of other artifacts; the filter requires the whole list of artifacts in advance to perform deduplication.
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 + 1 // 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 // UniversalBinary is a binary that contains multiple binaries within. UniversalBinary // 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 // Certificate is a signing certificate file Certificate // UploadableSourceArchive is the archive with the current commit source code. UploadableSourceArchive // BrewTap is an uploadable homebrew tap recipe file. BrewTap // PkgBuild is an Arch Linux AUR PKGBUILD file. PkgBuild // SrcInfo is an Arch Linux AUR .SRCINFO file. SrcInfo // KrewPluginManifest is a krew plugin manifest file. KrewPluginManifest // ScoopManifest is an uploadable scoop manifest file. ScoopManifest // SBOM is a Software Bill of Materials file. SBOM )