github.com/joselitofilho/goreleaser@v0.155.1-0.20210123221854-e4891856c593/internal/pipe/custompublishers/custompublishers.go (about)

     1  // Package custompublishers provides a Pipe that executes a custom publisher
     2  package custompublishers
     3  
     4  import (
     5  	"github.com/goreleaser/goreleaser/internal/exec"
     6  	"github.com/goreleaser/goreleaser/internal/pipe"
     7  	"github.com/goreleaser/goreleaser/pkg/context"
     8  )
     9  
    10  // Pipe for custom publisher.
    11  type Pipe struct{}
    12  
    13  // String returns the description of the pipe.
    14  func (Pipe) String() string {
    15  	return "custom publisher"
    16  }
    17  
    18  // Publish artifacts.
    19  func (Pipe) Publish(ctx *context.Context) error {
    20  	if len(ctx.Config.Publishers) == 0 {
    21  		return pipe.Skip("publishers section is not configured")
    22  	}
    23  
    24  	return exec.Execute(ctx, ctx.Config.Publishers)
    25  }