diff --git a/internal/pipe/winget/template.go b/internal/pipe/winget/template.go index f2bec3a70..7e44c2845 100644 --- a/internal/pipe/winget/template.go +++ b/internal/pipe/winget/template.go @@ -95,25 +95,27 @@ type Installer struct { // nolint: tagliatelle type Locale struct { - PackageIdentifier string `yaml:"PackageIdentifier,omitempty"` - PackageVersion string `yaml:"PackageVersion,omitempty"` - PackageLocale string `yaml:"PackageLocale,omitempty"` - Publisher string `yaml:"Publisher,omitempty"` - PublisherURL string `yaml:"PublisherUrl,omitempty"` - Author string `yaml:"Author,omitempty"` - PackageName string `yaml:"PackageName,omitempty"` - PackageURL string `yaml:"PackageUrl,omitempty"` - License string `yaml:"License,omitempty"` - LicenseURL string `yaml:"LicenseUrl,omitempty"` - Copyright string `yaml:"Copyright,omitempty"` - ShortDescription string `yaml:"ShortDescription,omitempty"` - Description string `yaml:"Description,omitempty"` - Moniker string `yaml:"Moniker,omitempty"` - Tags []string `yaml:"Tags,omitempty"` - ReleaseNotes string `yaml:"ReleaseNotes,omitempty"` - ReleaseNotesURL string `yaml:"ReleaseNotesUrl,omitempty"` - ManifestType string `yaml:"ManifestType,omitempty"` - ManifestVersion string `yaml:"ManifestVersion,omitempty"` + PackageIdentifier string `yaml:"PackageIdentifier,omitempty"` + PackageVersion string `yaml:"PackageVersion,omitempty"` + PackageLocale string `yaml:"PackageLocale,omitempty"` + Publisher string `yaml:"Publisher,omitempty"` + PublisherURL string `yaml:"PublisherUrl,omitempty"` + PublisherSupportURL string `yaml:"PublisherSupportUrl,omitempty"` + Author string `yaml:"Author,omitempty"` + PackageName string `yaml:"PackageName,omitempty"` + PackageURL string `yaml:"PackageUrl,omitempty"` + License string `yaml:"License,omitempty"` + LicenseURL string `yaml:"LicenseUrl,omitempty"` + Copyright string `yaml:"Copyright,omitempty"` + CopyrightURL string `yaml:"CopyrightUrl,omitempty"` + ShortDescription string `yaml:"ShortDescription,omitempty"` + Description string `yaml:"Description,omitempty"` + Moniker string `yaml:"Moniker,omitempty"` + Tags []string `yaml:"Tags,omitempty"` + ReleaseNotes string `yaml:"ReleaseNotes,omitempty"` + ReleaseNotesURL string `yaml:"ReleaseNotesUrl,omitempty"` + ManifestType string `yaml:"ManifestType,omitempty"` + ManifestVersion string `yaml:"ManifestVersion,omitempty"` } var fromGoArch = map[string]string{ diff --git a/internal/pipe/winget/testdata/TestRunPipe/full/full.locale.en-US.yaml.golden b/internal/pipe/winget/testdata/TestRunPipe/full/full.locale.en-US.yaml.golden index 387472b04..7a739a4f6 100644 --- a/internal/pipe/winget/testdata/TestRunPipe/full/full.locale.en-US.yaml.golden +++ b/internal/pipe/winget/testdata/TestRunPipe/full/full.locale.en-US.yaml.golden @@ -5,12 +5,14 @@ PackageVersion: 1.2.1 PackageLocale: en-US Publisher: Beckersoft PublisherUrl: https://carlosbecker.com +PublisherSupportUrl: https://carlosbecker.com/support Author: Carlos Becker PackageName: foo PackageUrl: https://goreleaser.com License: MIT LicenseUrl: https://goreleaser.com/eula/ Copyright: bla bla bla +CopyrightUrl: https://goreleaser.com/copyright ShortDescription: foo Description: |- long foo bar @@ -19,6 +21,9 @@ Description: |- sss Moniker: foo +Tags: + - foo + - bar ReleaseNotes: the changelog for this release... ReleaseNotesUrl: https://github.com/goreleaser/goreleaser/tags/v1.2.1 ManifestType: defaultLocale diff --git a/internal/pipe/winget/winget.go b/internal/pipe/winget/winget.go index fc2818b98..4c061c410 100644 --- a/internal/pipe/winget/winget.go +++ b/internal/pipe/winget/winget.go @@ -109,12 +109,17 @@ func (p Pipe) doRun(ctx *context.Context, winget config.Winget, cl client.Releas &winget.Name, &winget.Author, &winget.PublisherURL, + &winget.PublisherSupportURL, &winget.Homepage, &winget.SkipUpload, &winget.Description, &winget.ShortDescription, &winget.ReleaseNotesURL, &winget.Path, + &winget.Copyright, + &winget.CopyrightURL, + &winget.License, + &winget.LicenseURL, ) if err != nil { return err @@ -251,25 +256,27 @@ func (p Pipe) doRun(ctx *context.Context, winget config.Winget, cl client.Releas } return createYAML(ctx, winget, Locale{ - PackageIdentifier: winget.PackageIdentifier, - PackageVersion: ctx.Version, - PackageLocale: defaultLocale, - Publisher: winget.Publisher, - PublisherURL: winget.PublisherURL, - Author: winget.Author, - PackageName: winget.Name, - PackageURL: winget.Homepage, - License: winget.License, - LicenseURL: winget.LicenseURL, - Copyright: winget.Copyright, - ShortDescription: winget.ShortDescription, - Description: winget.Description, - Moniker: winget.Name, - Tags: []string{}, - ReleaseNotes: winget.ReleaseNotes, - ReleaseNotesURL: winget.ReleaseNotesURL, - ManifestType: "defaultLocale", - ManifestVersion: manifestVersion, + PackageIdentifier: winget.PackageIdentifier, + PackageVersion: ctx.Version, + PackageLocale: defaultLocale, + Publisher: winget.Publisher, + PublisherURL: winget.PublisherURL, + PublisherSupportURL: winget.PublisherSupportURL, + Author: winget.Author, + PackageName: winget.Name, + PackageURL: winget.Homepage, + License: winget.License, + LicenseURL: winget.LicenseURL, + Copyright: winget.Copyright, + CopyrightURL: winget.CopyrightURL, + ShortDescription: winget.ShortDescription, + Description: winget.Description, + Moniker: winget.Name, + Tags: winget.Tags, + ReleaseNotes: winget.ReleaseNotes, + ReleaseNotesURL: winget.ReleaseNotesURL, + ManifestType: "defaultLocale", + ManifestVersion: manifestVersion, }, artifact.WingetDefaultLocale) } diff --git a/internal/pipe/winget/winget_test.go b/internal/pipe/winget/winget_test.go index 61cce44ee..c7a23b7bf 100644 --- a/internal/pipe/winget/winget_test.go +++ b/internal/pipe/winget/winget_test.go @@ -62,18 +62,20 @@ func TestRunPipe(t *testing.T) { name: "full", expectPath: "manifests/b/Beckersoft LTDA/foo/1.2.1", winget: config.Winget{ - Name: "foo", - Publisher: "Beckersoft", - PublisherURL: "https://carlosbecker.com", - Copyright: "bla bla bla", - Author: "Carlos Becker", - Path: "manifests/b/Beckersoft LTDA/foo/{{.Version}}", - Repository: config.RepoRef{Owner: "foo", Name: "bar"}, - CommitAuthor: config.CommitAuthor{}, - IDs: []string{"foo"}, - Goamd64: "v1", - SkipUpload: "false", - ShortDescription: "foo", + Name: "foo", + Publisher: "Beckersoft", + PublisherURL: "https://carlosbecker.com", + PublisherSupportURL: "https://carlosbecker.com/support", + Copyright: "bla bla bla", + CopyrightURL: "https://goreleaser.com/copyright", + Author: "Carlos Becker", + Path: "manifests/b/Beckersoft LTDA/foo/{{.Version}}", + Repository: config.RepoRef{Owner: "foo", Name: "bar"}, + CommitAuthor: config.CommitAuthor{}, + IDs: []string{"foo"}, + Goamd64: "v1", + SkipUpload: "false", + ShortDescription: "foo", Description: `long foo bar yadaa yada yada loooaaasssss @@ -84,6 +86,7 @@ func TestRunPipe(t *testing.T) { LicenseURL: "https://goreleaser.com/eula/", ReleaseNotesURL: "https://github.com/goreleaser/goreleaser/tags/{{.Tag}}", ReleaseNotes: "{{.Changelog}}", + Tags: []string{"foo", "bar"}, }, }, { @@ -446,6 +449,80 @@ func TestRunPipe(t *testing.T) { }, }, }, + { + name: "bad-publisher-support-url-tmpl", + expectRunErrorIs: &template.Error{}, + winget: config.Winget{ + Name: "foo", + Publisher: "Beckersoft", + PublisherSupportURL: "{{.Nope}}", + License: "MIT", + ShortDescription: "foo bar zaz", + Repository: config.RepoRef{ + Owner: "foo", + Name: "bar", + }, + }, + }, + { + name: "bad-copyright-tmpl", + expectRunErrorIs: &template.Error{}, + winget: config.Winget{ + Name: "foo", + Publisher: "Beckersoft", + License: "MIT", + Copyright: "{{ .Nope }}", + ShortDescription: "foo bar zaz", + Repository: config.RepoRef{ + Owner: "foo", + Name: "bar", + }, + }, + }, + { + name: "bad-copyright-url-tmpl", + expectRunErrorIs: &template.Error{}, + winget: config.Winget{ + Name: "{{ .Nope }}", + Publisher: "Beckersoft", + License: "MIT", + CopyrightURL: "{{ .Nope }}", + ShortDescription: "foo bar zaz", + Repository: config.RepoRef{ + Owner: "foo", + Name: "bar", + }, + }, + }, + { + name: "bad-license-tmpl", + expectRunErrorIs: &template.Error{}, + winget: config.Winget{ + Name: "foo", + Publisher: "Beckersoft", + License: "{{ .Nope }}", + ShortDescription: "foo bar zaz", + Repository: config.RepoRef{ + Owner: "foo", + Name: "bar", + }, + }, + }, + { + name: "bad-license-url-tmpl", + expectRunErrorIs: &template.Error{}, + winget: config.Winget{ + Name: "foo", + Publisher: "Beckersoft", + License: "MIT", + LicenseURL: "{{ .Nope }}", + ShortDescription: "foo bar zaz", + Repository: config.RepoRef{ + Owner: "foo", + Name: "bar", + }, + }, + }, { name: "skip-upload", expectPublishErrorIs: errSkipUpload, diff --git a/pkg/config/config.go b/pkg/config/config.go index e5c6c3e1a..3f7f636f8 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -266,7 +266,9 @@ type Winget struct { PackageIdentifier string `yaml:"package_identifier,omitempty" json:"package_identifier,omitempty"` Publisher string `yaml:"publisher,omitempty" json:"publisher,omitempty"` PublisherURL string `yaml:"publisher_url,omitempty" json:"publisher_url,omitempty"` + PublisherSupportURL string `yaml:"publisher_support_url,omitempty" json:"publisher_support_url,omitempty"` Copyright string `yaml:"copyright,omitempty" json:"copyright,omitempty"` + CopyrightURL string `yaml:"copyright_url,omitempty" json:"copyright_url,omitempty"` Author string `yaml:"author,omitempty" json:"author,omitempty"` Path string `yaml:"path,omitempty" json:"path,omitempty"` Repository RepoRef `yaml:"repository,omitempty" json:"repository,omitempty"` @@ -283,6 +285,7 @@ type Winget struct { LicenseURL string `yaml:"license_url,omitempty" json:"license_url,omitempty"` ReleaseNotes string `yaml:"release_notes,omitempty" json:"release_notes,omitempty"` ReleaseNotesURL string `yaml:"release_notes_url,omitempty" json:"release_notes_url,omitempty"` + Tags []string `yaml:"tags,omitempty" json:"tags,omitempty"` } // Krew contains the krew section. diff --git a/www/docs/customization/winget.md b/www/docs/customization/winget.md index 14677bf01..1b9799a0c 100644 --- a/www/docs/customization/winget.md +++ b/www/docs/customization/winget.md @@ -30,6 +30,8 @@ winget: short_description: "Software to create fast and easy drum rolls." # License name. + # + # Templates: allowed # Required. license: "mit" @@ -38,6 +40,11 @@ winget: # Templates: allowed publisher_url: https://goreleaser.com + # Publisher support URL. + # + # Templates: allowed + publisher_support_url: "https://github.com/user/repo/issues/new" + # Package identifier. # # Default: Publisher.ProjectName @@ -86,11 +93,20 @@ winget: description: "Software to create fast and easy drum rolls." # License URL. + # + # Templates: allowed license_url: "https://goreleaser.com/license" # Copyright. + # + # Templates: allowed copyright: "Becker Software LTDA" + # Copyright URL. + # + # Templates: allowed + copyright_url: "https://goreleaser.com/copyright" + # Setting this will prevent goreleaser to actually try to commit the updated # package - instead, it will be stored on the dist folder only, # leaving the responsibility of publishing it to the user. @@ -114,6 +130,12 @@ winget: # Templates: allowed release_notes_url: "https://foo.bar/changelog/{{.Version}}" + # Tags. + tags: + - golang + - cli + + {% include-markdown "../includes/repository.md" comments=false %} ```