1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-10 03:47:03 +02:00
goreleaser/internal/pipeline/pipeline.go

137 lines
4.3 KiB
Go
Raw Normal View History

// Package pipeline provides generic errors for pipes to use.
2016-12-30 13:27:35 +02:00
package pipeline
2018-09-12 19:18:01 +02:00
import (
"fmt"
"github.com/goreleaser/goreleaser/internal/pipe/announce"
2018-09-12 19:18:01 +02:00
"github.com/goreleaser/goreleaser/internal/pipe/archive"
feat: arch user repository integration (#2838) * feat: aur PKGBUILD integration Signed-off-by: Carlos A Becker <caarlos0@gmail.com> * feat: guess install, improve formatting Signed-off-by: Carlos A Becker <caarlos0@gmail.com> * fix: more deterministic Signed-off-by: Carlos A Becker <caarlos0@gmail.com> * feat: binary releases, push, more tests Signed-off-by: Carlos A Becker <caarlos0@gmail.com> * feat: accept key as text Signed-off-by: Carlos A Becker <caarlos0@gmail.com> * feat: improvements Signed-off-by: Carlos A Becker <caarlos0@gmail.com> * feat: srcinfo Signed-off-by: Carlos A Becker <caarlos0@gmail.com> * fix: compile Signed-off-by: Carlos A Becker <caarlos0@gmail.com> * fix: everything Signed-off-by: Carlos A Becker <caarlos0@gmail.com> * fix: lint Signed-off-by: Carlos A Becker <caarlos0@gmail.com> * feat: renames, docs, etc Signed-off-by: Carlos A Becker <caarlos0@gmail.com> * docs: link to docs Signed-off-by: Carlos A Becker <caarlos0@gmail.com> * fix: go mod tidy, title Signed-off-by: Carlos A Becker <caarlos0@gmail.com> * fix: srcinfo tmpl Signed-off-by: Carlos A Becker <caarlos0@gmail.com> * fix: missing close quote Signed-off-by: Carlos A Becker <caarlos0@gmail.com> * fix: templates Signed-off-by: Carlos A Becker <caarlos0@gmail.com> * fix: always defaults conflicts and provides Signed-off-by: Carlos A Becker <caarlos0@gmail.com> * fix: ssh command Signed-off-by: Carlos A Becker <caarlos0@gmail.com> * fix: maintainers can be a list Signed-off-by: Carlos A Becker <caarlos0@gmail.com> * fix: ensure -bin suffix, more tests and docs Signed-off-by: Carlos A Becker <caarlos0@gmail.com> * fix: this will never happen Signed-off-by: Carlos A Becker <caarlos0@gmail.com> * fix: whitespaces Signed-off-by: Carlos A Becker <caarlos0@gmail.com> * fix: goreleaser config Signed-off-by: Carlos A Becker <caarlos0@gmail.com>
2022-01-20 19:59:39 +02:00
"github.com/goreleaser/goreleaser/internal/pipe/aur"
2018-09-12 19:18:01 +02:00
"github.com/goreleaser/goreleaser/internal/pipe/before"
feat: improve output and pipe skipping (#2480) * refactor: improve middleware Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: upload tests Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: twitter tests Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: source tests Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: snapshot tests Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * test: improved some tests Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: snapcraft skip Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: skip slack Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: skip sign Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: skip scoop Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: skip reddit Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: skip discord Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: skip publish Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: skip nfpm Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: skip milestone Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: skip custompublishers Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: skip checksums Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: skip changelog Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: skip brew Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: skip blob Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: skip before Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: skip artifactory Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: skip announce Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: skip defaults Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: cmds Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: skip docker Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * chore: todo Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: go.mod Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: skip release Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: remove old skip pipe errors Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: skip teams Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: skip brew Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix/test: skip smtp Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: lint issues Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: skip docker Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: skip brew and scoop Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: skip docker Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: skip http/artifactory Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * test: increase coverage Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * test: fix Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
2021-09-18 15:21:29 +02:00
"github.com/goreleaser/goreleaser/internal/pipe/brew"
2018-09-12 19:18:01 +02:00
"github.com/goreleaser/goreleaser/internal/pipe/build"
"github.com/goreleaser/goreleaser/internal/pipe/changelog"
"github.com/goreleaser/goreleaser/internal/pipe/checksums"
"github.com/goreleaser/goreleaser/internal/pipe/chocolatey"
2018-09-12 19:18:01 +02:00
"github.com/goreleaser/goreleaser/internal/pipe/defaults"
"github.com/goreleaser/goreleaser/internal/pipe/dist"
"github.com/goreleaser/goreleaser/internal/pipe/docker"
"github.com/goreleaser/goreleaser/internal/pipe/effectiveconfig"
"github.com/goreleaser/goreleaser/internal/pipe/env"
"github.com/goreleaser/goreleaser/internal/pipe/git"
"github.com/goreleaser/goreleaser/internal/pipe/gomod"
"github.com/goreleaser/goreleaser/internal/pipe/krew"
"github.com/goreleaser/goreleaser/internal/pipe/metadata"
2018-09-12 19:18:01 +02:00
"github.com/goreleaser/goreleaser/internal/pipe/nfpm"
"github.com/goreleaser/goreleaser/internal/pipe/nix"
"github.com/goreleaser/goreleaser/internal/pipe/prebuild"
2018-10-05 14:22:53 +02:00
"github.com/goreleaser/goreleaser/internal/pipe/publish"
"github.com/goreleaser/goreleaser/internal/pipe/reportsizes"
"github.com/goreleaser/goreleaser/internal/pipe/sbom"
feat: improve output and pipe skipping (#2480) * refactor: improve middleware Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: upload tests Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: twitter tests Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: source tests Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: snapshot tests Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * test: improved some tests Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: snapcraft skip Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: skip slack Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: skip sign Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: skip scoop Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: skip reddit Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: skip discord Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: skip publish Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: skip nfpm Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: skip milestone Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: skip custompublishers Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: skip checksums Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: skip changelog Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: skip brew Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: skip blob Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: skip before Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: skip artifactory Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: skip announce Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: skip defaults Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: cmds Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: skip docker Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * chore: todo Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: go.mod Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: skip release Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: remove old skip pipe errors Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: skip teams Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: skip brew Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix/test: skip smtp Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: lint issues Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: skip docker Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: skip brew and scoop Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: skip docker Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: skip http/artifactory Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * test: increase coverage Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * test: fix Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
2021-09-18 15:21:29 +02:00
"github.com/goreleaser/goreleaser/internal/pipe/scoop"
"github.com/goreleaser/goreleaser/internal/pipe/semver"
2018-09-12 19:18:01 +02:00
"github.com/goreleaser/goreleaser/internal/pipe/sign"
"github.com/goreleaser/goreleaser/internal/pipe/snapcraft"
2018-12-13 14:09:36 +02:00
"github.com/goreleaser/goreleaser/internal/pipe/snapshot"
"github.com/goreleaser/goreleaser/internal/pipe/sourcearchive"
"github.com/goreleaser/goreleaser/internal/pipe/universalbinary"
"github.com/goreleaser/goreleaser/internal/pipe/upx"
"github.com/goreleaser/goreleaser/internal/pipe/winget"
2018-09-12 19:18:01 +02:00
"github.com/goreleaser/goreleaser/pkg/context"
)
// Piper defines a pipe, which can be part of a pipeline (a series of pipes).
2018-09-12 19:18:01 +02:00
type Piper interface {
fmt.Stringer
// Run the pipe
Run(ctx *context.Context) error
2017-08-20 21:35:46 +02:00
}
// BuildPipeline contains all build-related pipe implementations in order.
// nolint:gochecknoglobals
var BuildPipeline = []Piper{
// load and validate environment variables
env.Pipe{},
// get and validate git repo state
git.Pipe{},
// parse current tag to a semver
semver.Pipe{},
// load default configs
defaults.Pipe{},
// snapshot version handling
snapshot.Pipe{},
// run global hooks before build
before.Pipe{},
// ensure ./dist is clean
dist.Pipe{},
// setup gomod-related stuff
gomod.Pipe{},
// run prebuild stuff
prebuild.Pipe{},
// proxy gomod if needed
gomod.ProxyPipe{},
// writes the actual config (with defaults et al set) to dist
effectiveconfig.Pipe{},
// build
build.Pipe{},
// universal binary handling
universalbinary.Pipe{},
// upx
upx.Pipe{},
2017-08-20 21:35:46 +02:00
}
// BuildCmdPipeline is the pipeline run by goreleaser build.
// nolint:gochecknoglobals
2023-04-30 19:00:43 +02:00
var BuildCmdPipeline = append(
BuildPipeline,
reportsizes.Pipe{},
metadata.Pipe{},
)
// Pipeline contains all pipe implementations in order.
// nolint: gochecknoglobals
var Pipeline = append(
BuildPipeline,
// builds the release changelog
changelog.Pipe{},
// archive in tar.gz, zip or binary (which does no archiving at all)
archive.Pipe{},
// archive the source code using git-archive
sourcearchive.Pipe{},
// archive via fpm (deb, rpm) using "native" go impl
nfpm.Pipe{},
// archive via snapcraft (snap)
snapcraft.Pipe{},
// create SBOMs of artifacts
sbom.Pipe{},
// checksums of the files
checksums.Pipe{},
// sign artifacts
sign.Pipe{},
// create arch linux aur pkgbuild
aur.Pipe{},
// create nixpkgs
nix.NewBuild(),
// winget installers
winget.Pipe{},
// create brew tap
brew.Pipe{},
// krew plugins
krew.Pipe{},
// create scoop buckets
scoop.Pipe{},
// create chocolatey pkg and publish
chocolatey.Pipe{},
// reports artifacts sizes to the log and to artifacts.json
reportsizes.Pipe{},
// create and push docker images
docker.Pipe{},
// publishes artifacts
publish.New(),
feat: add digest to artifacts info of published docker images (#3540) Extract the digest (sha256) of docker images from the `docker push` command for dockers published to the docker registry. Outputting the digest is required to avoid a race condition when referencing the image, where the image tag is being modified before the reference is done. See this [blog post](https://github.com/goreleaser/goreleaser/issues/3496) for more info. This PR fixes https://github.com/goreleaser/goreleaser/issues/3496. Note that the 'publish' pipe now must run before the 'metadata' pipe, so that the information extracted during the 'publish' pipe would appear in the metadata. Previously, the published docker images metadata wasn't printed (because of the order). It made sense because the content of the published image was just a subset of the local one. Now that it is printed to the metadata, it should have a different name to avoid confusion. As I mentioned, it wasn't printed before - so there shouldn't be any backward-compatibility issues. --- Local tests: ``` go test -v . === RUN TestVersion === RUN TestVersion/only_version === RUN TestVersion/version_and_date === RUN TestVersion/version,_date,_built_by === RUN TestVersion/all_empty === RUN TestVersion/complete --- PASS: TestVersion (0.00s) --- PASS: TestVersion/only_version (0.00s) --- PASS: TestVersion/version_and_date (0.00s) --- PASS: TestVersion/version,_date,_built_by (0.00s) --- PASS: TestVersion/all_empty (0.00s) --- PASS: TestVersion/complete (0.00s) PASS ok github.com/goreleaser/goreleaser 0.764s ``` Output example: ``` { "name": "gallegit/hello-world:latest", "path": "gallegit/hello-world:latest", "goos": "linux", "goarch": "amd64", "internal_type": 10, "type": "Published Docker Image", "extra": { "digest": "sha256:c3f7dd196a046dc061236d3c6ae1e2946269e90da30b0a959240ca799750e632" } } ``` Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com> Co-authored-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2022-11-12 19:51:53 +02:00
// creates a metadata.json and an artifacts.json files in the dist folder
metadata.Pipe{},
// announce releases
announce.Pipe{},
)