mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-02-11 13:38:41 +02:00
* feat: krew support * fix: adds it to the pipe * chore: fmt * test: improvements * fix: rm unused code * fix: stringer * fix: tmpl * test: improvements * fix: lint issues * fix: only allow 1 binary per archive * fix: validate * chore: comment * fix: renamed to manifest * fix: krew plugin manifest * fix: name * fix: godoc * fix: install validate-krew-manifest on ci * fix: helper * fix: ensure order * fix: testing * docs: guidelines * fix: flag
75 lines
2.2 KiB
Go
75 lines
2.2 KiB
Go
// Package publish contains the publishing pipe.
|
|
package publish
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/goreleaser/goreleaser/internal/middleware/errhandler"
|
|
"github.com/goreleaser/goreleaser/internal/middleware/logging"
|
|
"github.com/goreleaser/goreleaser/internal/middleware/skip"
|
|
"github.com/goreleaser/goreleaser/internal/pipe/artifactory"
|
|
"github.com/goreleaser/goreleaser/internal/pipe/blob"
|
|
"github.com/goreleaser/goreleaser/internal/pipe/brew"
|
|
"github.com/goreleaser/goreleaser/internal/pipe/custompublishers"
|
|
"github.com/goreleaser/goreleaser/internal/pipe/docker"
|
|
"github.com/goreleaser/goreleaser/internal/pipe/gofish"
|
|
"github.com/goreleaser/goreleaser/internal/pipe/krew"
|
|
"github.com/goreleaser/goreleaser/internal/pipe/milestone"
|
|
"github.com/goreleaser/goreleaser/internal/pipe/release"
|
|
"github.com/goreleaser/goreleaser/internal/pipe/scoop"
|
|
"github.com/goreleaser/goreleaser/internal/pipe/sign"
|
|
"github.com/goreleaser/goreleaser/internal/pipe/snapcraft"
|
|
"github.com/goreleaser/goreleaser/internal/pipe/upload"
|
|
"github.com/goreleaser/goreleaser/pkg/context"
|
|
)
|
|
|
|
// Publisher should be implemented by pipes that want to publish artifacts.
|
|
type Publisher interface {
|
|
fmt.Stringer
|
|
|
|
// Default sets the configuration defaults
|
|
Publish(ctx *context.Context) error
|
|
}
|
|
|
|
// nolint: gochecknoglobals
|
|
var publishers = []Publisher{
|
|
blob.Pipe{},
|
|
upload.Pipe{},
|
|
custompublishers.Pipe{},
|
|
artifactory.Pipe{},
|
|
docker.Pipe{},
|
|
docker.ManifestPipe{},
|
|
sign.DockerPipe{},
|
|
snapcraft.Pipe{},
|
|
// This should be one of the last steps
|
|
release.Pipe{},
|
|
// brew and scoop use the release URL, so, they should be last
|
|
brew.Pipe{},
|
|
gofish.Pipe{},
|
|
krew.Pipe{},
|
|
scoop.Pipe{},
|
|
milestone.Pipe{},
|
|
}
|
|
|
|
// Pipe that publishes artifacts.
|
|
type Pipe struct{}
|
|
|
|
func (Pipe) String() string { return "publishing" }
|
|
func (Pipe) Skip(ctx *context.Context) bool { return ctx.SkipPublish }
|
|
|
|
func (Pipe) Run(ctx *context.Context) error {
|
|
for _, publisher := range publishers {
|
|
if err := skip.Maybe(
|
|
publisher,
|
|
logging.Log(
|
|
publisher.String(),
|
|
errhandler.Handle(publisher.Publish),
|
|
logging.ExtraPadding,
|
|
),
|
|
)(ctx); err != nil {
|
|
return fmt.Errorf("%s: failed to publish artifacts: %w", publisher.String(), err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|