mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-01-26 04:22:05 +02:00
fix: snapcraft: do not push when skip publish (#1374)
* fix: snapcraft: do not publish when skip publish Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: snapcraft: do not publish when skip publish Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
This commit is contained in:
parent
969fb4b804
commit
2e69fa0667
@ -141,6 +141,9 @@ func isValidArch(arch string) bool {
|
||||
|
||||
// Publish packages
|
||||
func (Pipe) Publish(ctx *context.Context) error {
|
||||
if ctx.SkipPublish {
|
||||
return pipe.ErrSkipPublishEnabled
|
||||
}
|
||||
snaps := ctx.Artifacts.Filter(artifact.ByType(artifact.PublishableSnapcraft)).List()
|
||||
var g = semerrgroup.New(ctx.Parallelism)
|
||||
for _, snap := range snaps {
|
||||
|
@ -9,6 +9,7 @@ import (
|
||||
|
||||
"github.com/goreleaser/goreleaser/internal/artifact"
|
||||
"github.com/goreleaser/goreleaser/internal/pipe"
|
||||
"github.com/goreleaser/goreleaser/internal/testlib"
|
||||
"github.com/goreleaser/goreleaser/pkg/config"
|
||||
"github.com/goreleaser/goreleaser/pkg/context"
|
||||
"github.com/stretchr/testify/assert"
|
||||
@ -355,6 +356,19 @@ func TestPublish(t *testing.T) {
|
||||
assert.Contains(t, err.Error(), "failed to push nope.snap package")
|
||||
}
|
||||
|
||||
func TestPublishSkip(t *testing.T) {
|
||||
var ctx = context.New(config.Project{})
|
||||
ctx.SkipPublish = true
|
||||
ctx.Artifacts.Add(&artifact.Artifact{
|
||||
Name: "mybin",
|
||||
Path: "nope.snap",
|
||||
Goarch: "amd64",
|
||||
Goos: "linux",
|
||||
Type: artifact.PublishableSnapcraft,
|
||||
})
|
||||
testlib.AssertSkipped(t, Pipe{}.Publish(ctx))
|
||||
}
|
||||
|
||||
func TestDefaultSet(t *testing.T) {
|
||||
var ctx = context.New(config.Project{
|
||||
Snapcrafts: []config.Snapcraft{
|
||||
|
Loading…
x
Reference in New Issue
Block a user