mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-01-06 03:13:48 +02:00
16f1304498
* test: speed up minio tests Signed-off-by: Carlos A Becker <caarlos0@gmail.com> * test: speed up minio tests Signed-off-by: Carlos A Becker <caarlos0@gmail.com> * test: speed up minio tests Signed-off-by: Carlos A Becker <caarlos0@gmail.com> * fix: rm unused param Signed-off-by: Carlos A Becker <caarlos0@gmail.com> * fix: use not-so-common contianer name Signed-off-by: Carlos A Becker <caarlos0@gmail.com> * test: speed Signed-off-by: Carlos A Becker <caarlos0@gmail.com> * test: inc coverage Signed-off-by: Carlos A Becker <caarlos0@gmail.com> * test: inc coverage Signed-off-by: Carlos A Becker <caarlos0@gmail.com>
44 lines
1.1 KiB
Go
44 lines
1.1 KiB
Go
// Package blob provides the pipe implementation that uploads files to "blob" providers, such as s3, gcs and azure.
|
|
package blob
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/goreleaser/goreleaser/internal/semerrgroup"
|
|
"github.com/goreleaser/goreleaser/pkg/context"
|
|
)
|
|
|
|
// Pipe for blobs.
|
|
type Pipe struct{}
|
|
|
|
// String returns the description of the pipe.
|
|
func (Pipe) String() string { return "blobs" }
|
|
func (Pipe) Skip(ctx *context.Context) bool { return len(ctx.Config.Blobs) == 0 }
|
|
|
|
// Default sets the pipe defaults.
|
|
func (Pipe) Default(ctx *context.Context) error {
|
|
for i := range ctx.Config.Blobs {
|
|
blob := &ctx.Config.Blobs[i]
|
|
|
|
if blob.Bucket == "" || blob.Provider == "" {
|
|
return fmt.Errorf("bucket or provider cannot be empty")
|
|
}
|
|
if blob.Folder == "" {
|
|
blob.Folder = "{{ .ProjectName }}/{{ .Tag }}"
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Publish to specified blob bucket url.
|
|
func (Pipe) Publish(ctx *context.Context) error {
|
|
g := semerrgroup.New(ctx.Parallelism)
|
|
for _, conf := range ctx.Config.Blobs {
|
|
conf := conf
|
|
g.Go(func() error {
|
|
return doUpload(ctx, conf)
|
|
})
|
|
}
|
|
return g.Wait()
|
|
}
|