2023-06-05 18:08:57 +02:00
|
|
|
// 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"
|
|
|
|
|
2021-05-25 05:19:06 +02:00
|
|
|
"github.com/goreleaser/goreleaser/internal/pipe/announce"
|
2018-09-12 19:18:01 +02:00
|
|
|
"github.com/goreleaser/goreleaser/internal/pipe/archive"
|
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"
|
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"
|
feat: chocolatey support (#3509)
This PR adds support for generating the structure used to pack and push
Chocolatey Packages. And will solve the #3154
Is not ready for merge yet, but has the main structure, and ready for
comments.
Accordingly to Chocolatey, in order to build a package, it's necessary a
`.nuspec` and `chocolateyinstall.ps1` files at least, having these ones,
we could pack and distribute without adding the binary inside the final
package and that was implemented here.
To complete, will be necessary to define the package build and
distribute, however will be required to have Chocolatey installed
(Windows Only). One of alternatives that I thought was, publish the
files like Scoop and Brew in a separate repository, and there we could
use `chocolatey` through
[crazy-max/ghaction-chocolatey](https://github.com/crazy-max/ghaction-chocolatey).
Chocolatey has a lot of good examples of repositories:
https://github.com/chocolatey-community/chocolatey-packages/tree/master/automatic/curl
A final compilation of the missing parts:
- [x] How to pack and push (chocolatey)
- [x] Documentation
Sorry for the long description😄
All feedback very welcome!
Co-authored-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2022-11-12 04:52:32 +02:00
|
|
|
"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"
|
2021-09-11 19:46:30 +02:00
|
|
|
"github.com/goreleaser/goreleaser/internal/pipe/gomod"
|
2021-11-11 14:37:58 +02:00
|
|
|
"github.com/goreleaser/goreleaser/internal/pipe/krew"
|
2022-01-23 21:42:42 +02:00
|
|
|
"github.com/goreleaser/goreleaser/internal/pipe/metadata"
|
2018-09-12 19:18:01 +02:00
|
|
|
"github.com/goreleaser/goreleaser/internal/pipe/nfpm"
|
2023-05-26 04:07:10 +02:00
|
|
|
"github.com/goreleaser/goreleaser/internal/pipe/nix"
|
2022-01-14 15:33:11 +02:00
|
|
|
"github.com/goreleaser/goreleaser/internal/pipe/prebuild"
|
2018-10-05 14:22:53 +02:00
|
|
|
"github.com/goreleaser/goreleaser/internal/pipe/publish"
|
2023-04-24 01:27:16 +02:00
|
|
|
"github.com/goreleaser/goreleaser/internal/pipe/reportsizes"
|
2021-12-12 05:21:51 +02:00
|
|
|
"github.com/goreleaser/goreleaser/internal/pipe/sbom"
|
2021-09-18 15:21:29 +02:00
|
|
|
"github.com/goreleaser/goreleaser/internal/pipe/scoop"
|
2021-09-11 19:46:30 +02:00
|
|
|
"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"
|
2021-09-11 19:46:30 +02:00
|
|
|
"github.com/goreleaser/goreleaser/internal/pipe/sourcearchive"
|
2021-10-12 19:55:43 +02:00
|
|
|
"github.com/goreleaser/goreleaser/internal/pipe/universalbinary"
|
2023-05-02 02:22:05 +02:00
|
|
|
"github.com/goreleaser/goreleaser/internal/pipe/upx"
|
2023-06-15 04:59:55 +02:00
|
|
|
"github.com/goreleaser/goreleaser/internal/pipe/winget"
|
2018-09-12 19:18:01 +02:00
|
|
|
"github.com/goreleaser/goreleaser/pkg/context"
|
|
|
|
)
|
|
|
|
|
2021-05-25 05:19:06 +02:00
|
|
|
// 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
|
|
|
}
|
|
|
|
|
2020-11-27 04:16:08 +02:00
|
|
|
// BuildPipeline contains all build-related pipe implementations in order.
|
2020-05-15 16:19:20 +02:00
|
|
|
// nolint:gochecknoglobals
|
|
|
|
var BuildPipeline = []Piper{
|
2022-10-06 20:21:45 +02:00
|
|
|
// 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{},
|
|
|
|
// run global hooks before build
|
|
|
|
before.Pipe{},
|
|
|
|
// snapshot version handling
|
|
|
|
snapshot.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{},
|
2023-05-02 02:22:05 +02:00
|
|
|
// upx
|
|
|
|
upx.Pipe{},
|
2017-08-20 21:35:46 +02:00
|
|
|
}
|
2020-05-15 16:19:20 +02:00
|
|
|
|
2021-12-01 14:54:58 +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{},
|
|
|
|
)
|
2021-12-01 14:54:58 +02:00
|
|
|
|
2020-11-27 04:16:08 +02:00
|
|
|
// Pipeline contains all pipe implementations in order.
|
2020-05-15 16:19:20 +02:00
|
|
|
// nolint: gochecknoglobals
|
|
|
|
var Pipeline = append(
|
|
|
|
BuildPipeline,
|
2022-11-02 18:08:32 +02:00
|
|
|
// builds the release changelog
|
|
|
|
changelog.Pipe{},
|
2022-10-06 20:21:45 +02:00
|
|
|
// 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{},
|
2023-05-26 04:07:10 +02:00
|
|
|
// create nixpkgs
|
|
|
|
nix.NewBuild(),
|
2023-06-15 04:59:55 +02:00
|
|
|
// winget installers
|
|
|
|
winget.Pipe{},
|
2022-10-06 20:21:45 +02:00
|
|
|
// create brew tap
|
|
|
|
brew.Pipe{},
|
|
|
|
// krew plugins
|
|
|
|
krew.Pipe{},
|
|
|
|
// create scoop buckets
|
|
|
|
scoop.Pipe{},
|
feat: chocolatey support (#3509)
This PR adds support for generating the structure used to pack and push
Chocolatey Packages. And will solve the #3154
Is not ready for merge yet, but has the main structure, and ready for
comments.
Accordingly to Chocolatey, in order to build a package, it's necessary a
`.nuspec` and `chocolateyinstall.ps1` files at least, having these ones,
we could pack and distribute without adding the binary inside the final
package and that was implemented here.
To complete, will be necessary to define the package build and
distribute, however will be required to have Chocolatey installed
(Windows Only). One of alternatives that I thought was, publish the
files like Scoop and Brew in a separate repository, and there we could
use `chocolatey` through
[crazy-max/ghaction-chocolatey](https://github.com/crazy-max/ghaction-chocolatey).
Chocolatey has a lot of good examples of repositories:
https://github.com/chocolatey-community/chocolatey-packages/tree/master/automatic/curl
A final compilation of the missing parts:
- [x] How to pack and push (chocolatey)
- [x] Documentation
Sorry for the long description😄
All feedback very welcome!
Co-authored-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2022-11-12 04:52:32 +02:00
|
|
|
// create chocolatey pkg and publish
|
|
|
|
chocolatey.Pipe{},
|
2023-04-24 01:27:16 +02:00
|
|
|
// reports artifacts sizes to the log and to artifacts.json
|
|
|
|
reportsizes.Pipe{},
|
2022-10-06 20:21:45 +02:00
|
|
|
// create and push docker images
|
|
|
|
docker.Pipe{},
|
|
|
|
// publishes artifacts
|
|
|
|
publish.Pipe{},
|
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{},
|
2022-10-06 20:21:45 +02:00
|
|
|
// announce releases
|
|
|
|
announce.Pipe{},
|
2020-05-15 16:19:20 +02:00
|
|
|
)
|