mirror of
https://github.com/goreleaser/goreleaser.git
synced 2024-12-31 01:53:50 +02:00
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>
This commit is contained in:
parent
36aabe218a
commit
5a433347ac
@ -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.
|
||||
|
3
www/docs/static/schema.json
generated
vendored
3
www/docs/static/schema.json
generated
vendored
@ -1802,6 +1802,9 @@
|
||||
"disable": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"skip_upload": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"prerelease": {
|
||||
"type": "string"
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user