Skip to content
Permalink
Browse files
feat: allow to skip scm release uploads (#3282)
* feat: allow to skip scm release uploads

refs #3268

* chore: schema update

Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
  • Loading branch information
caarlos0 committed Aug 6, 2022
1 parent 36aabe2 commit 5a433347ac05932bcb8e761d359d6710eba80822
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 0 deletions.
@@ -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
@@ -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{})))
})
@@ -514,6 +514,7 @@ type Release struct {
Gitea Repo `yaml:"gitea,omitempty" json:"gitea,omitempty"`
Draft bool `yaml:"draft,omitempty" json:"draft,omitempty"`
Disable bool `yaml:"disable,omitempty" json:"disable,omitempty"`
SkipUpload bool `yaml:"skip_upload,omitempty" json:"skip_upload,omitempty"`
Prerelease string `yaml:"prerelease,omitempty" json:"prerelease,omitempty"`
NameTemplate string `yaml:"name_template,omitempty" json:"name_template,omitempty"`
IDs []string `yaml:"ids,omitempty" json:"ids,omitempty"`
@@ -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.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5a43334

Please sign in to comment.