diff --git a/internal/pipe/scoop/scoop.go b/internal/pipe/scoop/scoop.go index c46f0cabb..cc66e4cc5 100644 --- a/internal/pipe/scoop/scoop.go +++ b/internal/pipe/scoop/scoop.go @@ -143,7 +143,23 @@ func doRun(ctx *context.Context, scoop config.Scoop, cl client.ReleaserURLTempla return ErrIncorrectArchiveCount{scoop.Goamd64, scoop.IDs, archives} } - filename := scoop.Name + ".json" + name, err := tmpl.New(ctx).Apply(scoop.Name) + if err != nil { + return err + } + scoop.Name = name + + ref, err := client.TemplateRef(tmpl.New(ctx).Apply, scoop.Bucket) + if err != nil { + return err + } + scoop.Bucket = ref + + skipUpload, err := tmpl.New(ctx).Apply(scoop.SkipUpload) + if err != nil { + return err + } + scoop.SkipUpload = skipUpload data, err := dataFor(ctx, scoop, cl, archives) if err != nil { @@ -154,6 +170,7 @@ func doRun(ctx *context.Context, scoop config.Scoop, cl client.ReleaserURLTempla return err } + filename := scoop.Name + ".json" path := filepath.Join(ctx.Config.Dist, filename) log.WithField("manifest", path).Info("writing") if err := os.WriteFile(path, content.Bytes(), 0o644); err != nil { @@ -225,12 +242,6 @@ func doPublish(ctx *context.Context, manifest *artifact.Artifact, cl client.Clie return err } - ref, err := client.TemplateRef(tmpl.New(ctx).Apply, scoop.Bucket) - if err != nil { - return err - } - scoop.Bucket = ref - repo := client.RepoFromRef(scoop.Bucket) gpath := path.Join(scoop.Folder, manifest.Name) diff --git a/internal/pipe/scoop/scoop_test.go b/internal/pipe/scoop/scoop_test.go index f3a18b73b..c89ed8cf9 100644 --- a/internal/pipe/scoop/scoop_test.go +++ b/internal/pipe/scoop/scoop_test.go @@ -591,8 +591,8 @@ func Test_doRun(t *testing.T) { []artifact.Artifact{ {Name: "foo_1.0.1-pre.1_windows_amd64.tar.gz", Goos: "windows", Goarch: "amd64", Goamd64: "v1", Path: file}, }, - shouldNotErr, testlib.RequireTemplateError, + shouldNotErr, noAssertions, }, { diff --git a/www/docs/customization/scoop.md b/www/docs/customization/scoop.md index 39bf9d369..23d1824e9 100644 --- a/www/docs/customization/scoop.md +++ b/www/docs/customization/scoop.md @@ -11,6 +11,12 @@ commented example below: # Since: v1.18 scoops: - + # Name of the recipe + # + # Default: ProjectName + # Templates: allowed (since v1.19) + name: myproject + # URL which is determined by the given Token (github or gitlab) # # Default: @@ -40,6 +46,8 @@ scoops: # Optionally a token can be provided, if it differs from the token provided # to GoReleaser + # + # Templates: allowed token: "{{ .Env.SCOOP_TAP_GITHUB_TOKEN }}" # Sets up pull request creation instead of just pushing to the given branch. @@ -64,6 +72,8 @@ scoops: # Since: v1.18 git: # The Git URL to push. + # + # Templates: allowed url: 'ssh://git@myserver.com:repo.git' # The SSH private key that should be used to commit to the Git @@ -73,6 +83,8 @@ scoops: # IMPORTANT: the key must not be password-protected. # # WARNING: do not expose your private key in the configuration file! + # + # Templates: allowed private_key: '{{ .Env.PRIVATE_KEY_PATH }}' # The value to be passed to `GIT_SSH_COMMAND`. @@ -80,6 +92,7 @@ scoops: # to the Git URL. # # Default: 'ssh -i {{ .KeyPath }} -o StrictHostKeyChecking=accept-new -F /dev/null' + # Templates: allowed ssh_command: 'ssh -i {{ .Env.KEY }} -o SomeOption=yes' # Folder inside the repository to put the scoop. @@ -113,6 +126,8 @@ scoops: # manifest leaving the responsibility of publishing it to the user. # If set to auto, the release will not be uploaded to the scoop bucket # in case there is an indicator for prerelease in the tag e.g. v1.0.0-rc1 + # + # Templates: allowed (since v1.19) skip_upload: true # Persist data between application updates