From bce2e56ba1d090181fc551bf0321442036ad58a1 Mon Sep 17 00:00:00 2001 From: Carlos A Becker Date: Wed, 3 Aug 2022 15:08:41 -0300 Subject: [PATCH 1/2] feat: allow to skip scm release uploads refs #3268 --- internal/pipe/release/release.go | 5 +++++ internal/pipe/release/release_test.go | 12 ++++++++++++ pkg/config/config.go | 1 + www/docs/customization/release.md | 6 ++++++ 4 files changed, 24 insertions(+) diff --git a/internal/pipe/release/release.go b/internal/pipe/release/release.go index 960556c3d1b..ca2aa996437 100644 --- a/internal/pipe/release/release.go +++ b/internal/pipe/release/release.go @@ -11,6 +11,7 @@ import ( "github.com/goreleaser/goreleaser/internal/client" "github.com/goreleaser/goreleaser/internal/extrafiles" "github.com/goreleaser/goreleaser/internal/git" + "github.com/goreleaser/goreleaser/internal/pipe" "github.com/goreleaser/goreleaser/internal/semerrgroup" "github.com/goreleaser/goreleaser/pkg/config" "github.com/goreleaser/goreleaser/pkg/context" @@ -110,6 +111,10 @@ func doPublish(ctx *context.Context, client client.Client) error { return err } + if ctx.Config.Release.SkipUpload { + return pipe.Skip("release.skip_upload is set") + } + extraFiles, err := extrafiles.Find(ctx, ctx.Config.Release.ExtraFiles) if err != nil { return err diff --git a/internal/pipe/release/release_test.go b/internal/pipe/release/release_test.go index 2414954e925..d739e053914 100644 --- a/internal/pipe/release/release_test.go +++ b/internal/pipe/release/release_test.go @@ -612,6 +612,18 @@ func TestSkip(t *testing.T) { require.True(t, Pipe{}.Skip(ctx)) }) + t.Run("skip upload", func(t *testing.T) { + ctx := context.New(config.Project{ + Release: config.Release{ + SkipUpload: true, + }, + }) + client := &client.Mock{} + testlib.AssertSkipped(t, doPublish(ctx, client)) + require.True(t, client.CreatedRelease) + require.False(t, client.UploadedFile) + }) + t.Run("dont skip", func(t *testing.T) { require.False(t, Pipe{}.Skip(context.New(config.Project{}))) }) diff --git a/pkg/config/config.go b/pkg/config/config.go index f609e3ac53c..09f2440b486 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -514,6 +514,7 @@ type Release struct { Gitea Repo `yaml:"gitea,omitempty"` Draft bool `yaml:"draft,omitempty"` Disable bool `yaml:"disable,omitempty"` + SkipUpload bool `yaml:"skip_upload,omitempty"` Prerelease string `yaml:"prerelease,omitempty"` NameTemplate string `yaml:"name_template,omitempty"` IDs []string `yaml:"ids,omitempty"` diff --git a/www/docs/customization/release.md b/www/docs/customization/release.md index 9b523dad519..0019d8c9bbe 100644 --- a/www/docs/customization/release.md +++ b/www/docs/customization/release.md @@ -76,6 +76,12 @@ release: # Defaults to false. disable: true + # Set this to true if you want to disable just the artifact upload to the SCM. + # If this is true, GoReleaser will still create the release with the changelog, but won't upload anything to it. + # + # Defaults to false. + skip_upload: true + # You can add extra pre-existing files to the release. # The filename on the release will be the last part of the path (base). # If another file with the same name exists, the last one found will be used. From 0b3ed8e2c114f3d2930a756dcd75d8e4fdba6f08 Mon Sep 17 00:00:00 2001 From: Carlos A Becker Date: Sat, 6 Aug 2022 18:48:28 -0300 Subject: [PATCH 2/2] chore: schema update Signed-off-by: Carlos A Becker --- www/docs/static/schema.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/www/docs/static/schema.json b/www/docs/static/schema.json index 4ec69d44d91..3a8acbe26e2 100644 --- a/www/docs/static/schema.json +++ b/www/docs/static/schema.json @@ -1802,6 +1802,9 @@ "disable": { "type": "boolean" }, + "skip_upload": { + "type": "boolean" + }, "prerelease": { "type": "string" },