2018-10-05 09:22:53 -03:00
|
|
|
// Package publish contains the publishing pipe.
|
|
|
|
package publish
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
2021-09-18 10:21:29 -03:00
|
|
|
"github.com/goreleaser/goreleaser/internal/middleware/errhandler"
|
|
|
|
"github.com/goreleaser/goreleaser/internal/middleware/logging"
|
|
|
|
"github.com/goreleaser/goreleaser/internal/middleware/skip"
|
2018-10-16 22:29:02 -03:00
|
|
|
"github.com/goreleaser/goreleaser/internal/pipe/artifactory"
|
2022-01-20 14:59:39 -03:00
|
|
|
"github.com/goreleaser/goreleaser/internal/pipe/aur"
|
2019-06-05 15:51:01 +02:00
|
|
|
"github.com/goreleaser/goreleaser/internal/pipe/blob"
|
2018-10-10 12:47:31 -03:00
|
|
|
"github.com/goreleaser/goreleaser/internal/pipe/brew"
|
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 03:52:32 +01:00
|
|
|
"github.com/goreleaser/goreleaser/internal/pipe/chocolatey"
|
2020-05-10 17:03:49 +01:00
|
|
|
"github.com/goreleaser/goreleaser/internal/pipe/custompublishers"
|
2018-10-20 13:45:31 -03:00
|
|
|
"github.com/goreleaser/goreleaser/internal/pipe/docker"
|
2023-01-16 22:34:49 -03:00
|
|
|
"github.com/goreleaser/goreleaser/internal/pipe/ko"
|
2021-11-11 09:37:58 -03:00
|
|
|
"github.com/goreleaser/goreleaser/internal/pipe/krew"
|
2020-07-09 16:40:37 -04:00
|
|
|
"github.com/goreleaser/goreleaser/internal/pipe/milestone"
|
2018-10-16 20:39:10 -03:00
|
|
|
"github.com/goreleaser/goreleaser/internal/pipe/release"
|
2018-10-10 12:47:31 -03:00
|
|
|
"github.com/goreleaser/goreleaser/internal/pipe/scoop"
|
2021-09-11 14:46:30 -03:00
|
|
|
"github.com/goreleaser/goreleaser/internal/pipe/sign"
|
2018-10-20 14:25:46 -03:00
|
|
|
"github.com/goreleaser/goreleaser/internal/pipe/snapcraft"
|
2019-11-18 10:34:17 -03:00
|
|
|
"github.com/goreleaser/goreleaser/internal/pipe/upload"
|
2018-10-05 09:22:53 -03:00
|
|
|
"github.com/goreleaser/goreleaser/pkg/context"
|
|
|
|
)
|
|
|
|
|
2020-05-26 00:48:10 -03:00
|
|
|
// Publisher should be implemented by pipes that want to publish artifacts.
|
2018-10-05 09:22:53 -03:00
|
|
|
type Publisher interface {
|
|
|
|
fmt.Stringer
|
|
|
|
|
|
|
|
// Default sets the configuration defaults
|
|
|
|
Publish(ctx *context.Context) error
|
|
|
|
}
|
|
|
|
|
2018-11-07 22:04:49 -02:00
|
|
|
// nolint: gochecknoglobals
|
2018-10-10 12:47:31 -03:00
|
|
|
var publishers = []Publisher{
|
2019-06-05 15:51:01 +02:00
|
|
|
blob.Pipe{},
|
2019-11-18 10:34:17 -03:00
|
|
|
upload.Pipe{},
|
2018-10-16 22:29:02 -03:00
|
|
|
artifactory.Pipe{},
|
2022-10-17 21:19:11 -03:00
|
|
|
custompublishers.Pipe{},
|
2018-10-20 13:45:31 -03:00
|
|
|
docker.Pipe{},
|
2020-11-28 16:26:37 -03:00
|
|
|
docker.ManifestPipe{},
|
2023-01-16 22:34:49 -03:00
|
|
|
ko.Pipe{},
|
2021-09-11 14:46:30 -03:00
|
|
|
sign.DockerPipe{},
|
2018-10-20 14:25:46 -03:00
|
|
|
snapcraft.Pipe{},
|
2018-10-27 13:36:26 -03:00
|
|
|
// This should be one of the last steps
|
2018-10-25 11:46:30 +01:00
|
|
|
release.Pipe{},
|
2022-01-20 14:59:39 -03:00
|
|
|
// brew et al use the release URL, so, they should be last
|
2018-10-27 13:36:26 -03:00
|
|
|
brew.Pipe{},
|
2022-01-20 14:59:39 -03:00
|
|
|
aur.Pipe{},
|
2021-11-11 09:37:58 -03:00
|
|
|
krew.Pipe{},
|
2018-10-27 13:36:26 -03:00
|
|
|
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 03:52:32 +01:00
|
|
|
chocolatey.Pipe{},
|
2020-07-09 16:40:37 -04:00
|
|
|
milestone.Pipe{},
|
2018-10-10 12:47:31 -03:00
|
|
|
}
|
2018-10-05 09:22:53 -03:00
|
|
|
|
2021-09-18 10:21:29 -03:00
|
|
|
// Pipe that publishes artifacts.
|
|
|
|
type Pipe struct{}
|
|
|
|
|
|
|
|
func (Pipe) String() string { return "publishing" }
|
|
|
|
func (Pipe) Skip(ctx *context.Context) bool { return ctx.SkipPublish }
|
|
|
|
|
2018-10-05 09:22:53 -03:00
|
|
|
func (Pipe) Run(ctx *context.Context) error {
|
|
|
|
for _, publisher := range publishers {
|
2021-09-18 10:21:29 -03:00
|
|
|
if err := skip.Maybe(
|
|
|
|
publisher,
|
2022-06-21 21:11:15 -03:00
|
|
|
logging.PadLog(
|
2021-09-18 10:21:29 -03:00
|
|
|
publisher.String(),
|
|
|
|
errhandler.Handle(publisher.Publish),
|
|
|
|
),
|
2019-01-22 01:56:16 -02:00
|
|
|
)(ctx); err != nil {
|
2020-09-21 14:47:51 -03:00
|
|
|
return fmt.Errorf("%s: failed to publish artifacts: %w", publisher.String(), err)
|
2018-10-05 09:22:53 -03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|