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

     1  // Package pipeline provides generic erros for pipes to use.
     2  package pipeline
     3  
     4  import (
     5  	"fmt"
     6  
     7  	"github.com/goreleaser/goreleaser/internal/pipe/semver"
     8  	"github.com/goreleaser/goreleaser/internal/pipe/sourcearchive"
     9  
    10  	"github.com/goreleaser/goreleaser/internal/pipe/archive"
    11  	"github.com/goreleaser/goreleaser/internal/pipe/before"
    12  	"github.com/goreleaser/goreleaser/internal/pipe/build"
    13  	"github.com/goreleaser/goreleaser/internal/pipe/changelog"
    14  	"github.com/goreleaser/goreleaser/internal/pipe/checksums"
    15  	"github.com/goreleaser/goreleaser/internal/pipe/defaults"
    16  	"github.com/goreleaser/goreleaser/internal/pipe/dist"
    17  	"github.com/goreleaser/goreleaser/internal/pipe/docker"
    18  	"github.com/goreleaser/goreleaser/internal/pipe/effectiveconfig"
    19  	"github.com/goreleaser/goreleaser/internal/pipe/env"
    20  	"github.com/goreleaser/goreleaser/internal/pipe/git"
    21  	"github.com/goreleaser/goreleaser/internal/pipe/nfpm"
    22  	"github.com/goreleaser/goreleaser/internal/pipe/publish"
    23  	"github.com/goreleaser/goreleaser/internal/pipe/sign"
    24  	"github.com/goreleaser/goreleaser/internal/pipe/snapcraft"
    25  	"github.com/goreleaser/goreleaser/internal/pipe/snapshot"
    26  	"github.com/goreleaser/goreleaser/pkg/context"
    27  )
    28  
    29  // Piper defines a pipe, which can be part of a pipeline (a serie of pipes).
    30  type Piper interface {
    31  	fmt.Stringer
    32  
    33  	// Run the pipe
    34  	Run(ctx *context.Context) error
    35  }
    36  
    37  // BuildPipeline contains all build-related pipe implementations in order.
    38  // nolint:gochecknoglobals
    39  var BuildPipeline = []Piper{
    40  	env.Pipe{},             // load and validate environment variables
    41  	git.Pipe{},             // get and validate git repo state
    42  	semver.Pipe{},          // parse current tag to a semver
    43  	before.Pipe{},          // run global hooks before build
    44  	defaults.Pipe{},        // load default configs
    45  	snapshot.Pipe{},        // snapshot version handling
    46  	dist.Pipe{},            // ensure ./dist is clean
    47  	effectiveconfig.Pipe{}, // writes the actual config (with defaults et al set) to dist
    48  	changelog.Pipe{},       // builds the release changelog
    49  	build.Pipe{},           // build
    50  }
    51  
    52  // Pipeline contains all pipe implementations in order.
    53  // nolint: gochecknoglobals
    54  var Pipeline = append(
    55  	BuildPipeline,
    56  	archive.Pipe{},       // archive in tar.gz, zip or binary (which does no archiving at all)
    57  	sourcearchive.Pipe{}, // archive the source code using git-archive
    58  	nfpm.Pipe{},          // archive via fpm (deb, rpm) using "native" go impl
    59  	snapcraft.Pipe{},     // archive via snapcraft (snap)
    60  	checksums.Pipe{},     // checksums of the files
    61  	sign.Pipe{},          // sign artifacts
    62  	docker.Pipe{},        // create and push docker images
    63  	publish.Pipe{},       // publishes artifacts
    64  )