mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-02-03 13:11:48 +02:00
f2281e8ff2
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>
76 lines
2.3 KiB
Go
76 lines
2.3 KiB
Go
// Package publish contains the publishing pipe.
|
|
package publish
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/goreleaser/goreleaser/internal/middleware/errhandler"
|
|
"github.com/goreleaser/goreleaser/internal/middleware/logging"
|
|
"github.com/goreleaser/goreleaser/internal/middleware/skip"
|
|
"github.com/goreleaser/goreleaser/internal/pipe/artifactory"
|
|
"github.com/goreleaser/goreleaser/internal/pipe/aur"
|
|
"github.com/goreleaser/goreleaser/internal/pipe/blob"
|
|
"github.com/goreleaser/goreleaser/internal/pipe/brew"
|
|
"github.com/goreleaser/goreleaser/internal/pipe/chocolatey"
|
|
"github.com/goreleaser/goreleaser/internal/pipe/custompublishers"
|
|
"github.com/goreleaser/goreleaser/internal/pipe/docker"
|
|
"github.com/goreleaser/goreleaser/internal/pipe/krew"
|
|
"github.com/goreleaser/goreleaser/internal/pipe/milestone"
|
|
"github.com/goreleaser/goreleaser/internal/pipe/release"
|
|
"github.com/goreleaser/goreleaser/internal/pipe/scoop"
|
|
"github.com/goreleaser/goreleaser/internal/pipe/sign"
|
|
"github.com/goreleaser/goreleaser/internal/pipe/snapcraft"
|
|
"github.com/goreleaser/goreleaser/internal/pipe/upload"
|
|
"github.com/goreleaser/goreleaser/pkg/context"
|
|
)
|
|
|
|
// Publisher should be implemented by pipes that want to publish artifacts.
|
|
type Publisher interface {
|
|
fmt.Stringer
|
|
|
|
// Default sets the configuration defaults
|
|
Publish(ctx *context.Context) error
|
|
}
|
|
|
|
// nolint: gochecknoglobals
|
|
var publishers = []Publisher{
|
|
blob.Pipe{},
|
|
upload.Pipe{},
|
|
artifactory.Pipe{},
|
|
custompublishers.Pipe{},
|
|
docker.Pipe{},
|
|
docker.ManifestPipe{},
|
|
sign.DockerPipe{},
|
|
snapcraft.Pipe{},
|
|
// This should be one of the last steps
|
|
release.Pipe{},
|
|
// brew et al use the release URL, so, they should be last
|
|
brew.Pipe{},
|
|
aur.Pipe{},
|
|
krew.Pipe{},
|
|
scoop.Pipe{},
|
|
chocolatey.Pipe{},
|
|
milestone.Pipe{},
|
|
}
|
|
|
|
// Pipe that publishes artifacts.
|
|
type Pipe struct{}
|
|
|
|
func (Pipe) String() string { return "publishing" }
|
|
func (Pipe) Skip(ctx *context.Context) bool { return ctx.SkipPublish }
|
|
|
|
func (Pipe) Run(ctx *context.Context) error {
|
|
for _, publisher := range publishers {
|
|
if err := skip.Maybe(
|
|
publisher,
|
|
logging.PadLog(
|
|
publisher.String(),
|
|
errhandler.Handle(publisher.Publish),
|
|
),
|
|
)(ctx); err != nil {
|
|
return fmt.Errorf("%s: failed to publish artifacts: %w", publisher.String(), err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|