1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-10 03:47:03 +02:00
goreleaser/internal/pipe/publish/publish.go
Carlos Alexandro Becker e337fc9ca0
feat: multi-arch docker images (#1923)
* feat: multi-arch docker images

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>

* feat: split files

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>

* docs: manifest

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>

* refactor: split files

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>

* test: added some

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>

* docs: flags

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>

* fix: fmt

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>

* fix: diff

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>

* ci: enable experimental

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>

* ci: multi-arch goreleaser images

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
2020-11-28 16:26:37 -03:00

66 lines
1.8 KiB
Go

// Package publish contains the publishing pipe.
package publish
import (
"fmt"
"github.com/goreleaser/goreleaser/internal/middleware"
"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/milestone"
"github.com/goreleaser/goreleaser/internal/pipe/release"
"github.com/goreleaser/goreleaser/internal/pipe/scoop"
"github.com/goreleaser/goreleaser/internal/pipe/snapcraft"
"github.com/goreleaser/goreleaser/internal/pipe/upload"
"github.com/goreleaser/goreleaser/pkg/context"
)
// Pipe that publishes artifacts.
type Pipe struct{}
func (Pipe) String() string {
return "publishing"
}
// 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{},
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{},
scoop.Pipe{},
milestone.Pipe{},
}
// Run the pipe.
func (Pipe) Run(ctx *context.Context) error {
for _, publisher := range publishers {
if err := middleware.Logging(
publisher.String(),
middleware.ErrHandler(publisher.Publish),
middleware.ExtraPadding,
)(ctx); err != nil {
return fmt.Errorf("%s: failed to publish artifacts: %w", publisher.String(), err)
}
}
return nil
}