You've already forked goreleaser
mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-09-16 09:26:52 +02:00
fix(winget): add missing fields, more templates (#4164)
This adds missing fields: - LicenseURL - CopyrightURL - Tags As well as make several more fields templateable. cc/ @twpayne Co-authored-by: Tom Payne <tom.payne@flarm.com>
This commit is contained in:
committed by
GitHub
parent
4c9314b06f
commit
a324009978
@@ -95,25 +95,27 @@ type Installer struct {
|
|||||||
|
|
||||||
// nolint: tagliatelle
|
// nolint: tagliatelle
|
||||||
type Locale struct {
|
type Locale struct {
|
||||||
PackageIdentifier string `yaml:"PackageIdentifier,omitempty"`
|
PackageIdentifier string `yaml:"PackageIdentifier,omitempty"`
|
||||||
PackageVersion string `yaml:"PackageVersion,omitempty"`
|
PackageVersion string `yaml:"PackageVersion,omitempty"`
|
||||||
PackageLocale string `yaml:"PackageLocale,omitempty"`
|
PackageLocale string `yaml:"PackageLocale,omitempty"`
|
||||||
Publisher string `yaml:"Publisher,omitempty"`
|
Publisher string `yaml:"Publisher,omitempty"`
|
||||||
PublisherURL string `yaml:"PublisherUrl,omitempty"`
|
PublisherURL string `yaml:"PublisherUrl,omitempty"`
|
||||||
Author string `yaml:"Author,omitempty"`
|
PublisherSupportURL string `yaml:"PublisherSupportUrl,omitempty"`
|
||||||
PackageName string `yaml:"PackageName,omitempty"`
|
Author string `yaml:"Author,omitempty"`
|
||||||
PackageURL string `yaml:"PackageUrl,omitempty"`
|
PackageName string `yaml:"PackageName,omitempty"`
|
||||||
License string `yaml:"License,omitempty"`
|
PackageURL string `yaml:"PackageUrl,omitempty"`
|
||||||
LicenseURL string `yaml:"LicenseUrl,omitempty"`
|
License string `yaml:"License,omitempty"`
|
||||||
Copyright string `yaml:"Copyright,omitempty"`
|
LicenseURL string `yaml:"LicenseUrl,omitempty"`
|
||||||
ShortDescription string `yaml:"ShortDescription,omitempty"`
|
Copyright string `yaml:"Copyright,omitempty"`
|
||||||
Description string `yaml:"Description,omitempty"`
|
CopyrightURL string `yaml:"CopyrightUrl,omitempty"`
|
||||||
Moniker string `yaml:"Moniker,omitempty"`
|
ShortDescription string `yaml:"ShortDescription,omitempty"`
|
||||||
Tags []string `yaml:"Tags,omitempty"`
|
Description string `yaml:"Description,omitempty"`
|
||||||
ReleaseNotes string `yaml:"ReleaseNotes,omitempty"`
|
Moniker string `yaml:"Moniker,omitempty"`
|
||||||
ReleaseNotesURL string `yaml:"ReleaseNotesUrl,omitempty"`
|
Tags []string `yaml:"Tags,omitempty"`
|
||||||
ManifestType string `yaml:"ManifestType,omitempty"`
|
ReleaseNotes string `yaml:"ReleaseNotes,omitempty"`
|
||||||
ManifestVersion string `yaml:"ManifestVersion,omitempty"`
|
ReleaseNotesURL string `yaml:"ReleaseNotesUrl,omitempty"`
|
||||||
|
ManifestType string `yaml:"ManifestType,omitempty"`
|
||||||
|
ManifestVersion string `yaml:"ManifestVersion,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
var fromGoArch = map[string]string{
|
var fromGoArch = map[string]string{
|
||||||
|
@@ -5,12 +5,14 @@ PackageVersion: 1.2.1
|
|||||||
PackageLocale: en-US
|
PackageLocale: en-US
|
||||||
Publisher: Beckersoft
|
Publisher: Beckersoft
|
||||||
PublisherUrl: https://carlosbecker.com
|
PublisherUrl: https://carlosbecker.com
|
||||||
|
PublisherSupportUrl: https://carlosbecker.com/support
|
||||||
Author: Carlos Becker
|
Author: Carlos Becker
|
||||||
PackageName: foo
|
PackageName: foo
|
||||||
PackageUrl: https://goreleaser.com
|
PackageUrl: https://goreleaser.com
|
||||||
License: MIT
|
License: MIT
|
||||||
LicenseUrl: https://goreleaser.com/eula/
|
LicenseUrl: https://goreleaser.com/eula/
|
||||||
Copyright: bla bla bla
|
Copyright: bla bla bla
|
||||||
|
CopyrightUrl: https://goreleaser.com/copyright
|
||||||
ShortDescription: foo
|
ShortDescription: foo
|
||||||
Description: |-
|
Description: |-
|
||||||
long foo bar
|
long foo bar
|
||||||
@@ -19,6 +21,9 @@ Description: |-
|
|||||||
|
|
||||||
sss
|
sss
|
||||||
Moniker: foo
|
Moniker: foo
|
||||||
|
Tags:
|
||||||
|
- foo
|
||||||
|
- bar
|
||||||
ReleaseNotes: the changelog for this release...
|
ReleaseNotes: the changelog for this release...
|
||||||
ReleaseNotesUrl: https://github.com/goreleaser/goreleaser/tags/v1.2.1
|
ReleaseNotesUrl: https://github.com/goreleaser/goreleaser/tags/v1.2.1
|
||||||
ManifestType: defaultLocale
|
ManifestType: defaultLocale
|
||||||
|
@@ -109,12 +109,17 @@ func (p Pipe) doRun(ctx *context.Context, winget config.Winget, cl client.Releas
|
|||||||
&winget.Name,
|
&winget.Name,
|
||||||
&winget.Author,
|
&winget.Author,
|
||||||
&winget.PublisherURL,
|
&winget.PublisherURL,
|
||||||
|
&winget.PublisherSupportURL,
|
||||||
&winget.Homepage,
|
&winget.Homepage,
|
||||||
&winget.SkipUpload,
|
&winget.SkipUpload,
|
||||||
&winget.Description,
|
&winget.Description,
|
||||||
&winget.ShortDescription,
|
&winget.ShortDescription,
|
||||||
&winget.ReleaseNotesURL,
|
&winget.ReleaseNotesURL,
|
||||||
&winget.Path,
|
&winget.Path,
|
||||||
|
&winget.Copyright,
|
||||||
|
&winget.CopyrightURL,
|
||||||
|
&winget.License,
|
||||||
|
&winget.LicenseURL,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -251,25 +256,27 @@ func (p Pipe) doRun(ctx *context.Context, winget config.Winget, cl client.Releas
|
|||||||
}
|
}
|
||||||
|
|
||||||
return createYAML(ctx, winget, Locale{
|
return createYAML(ctx, winget, Locale{
|
||||||
PackageIdentifier: winget.PackageIdentifier,
|
PackageIdentifier: winget.PackageIdentifier,
|
||||||
PackageVersion: ctx.Version,
|
PackageVersion: ctx.Version,
|
||||||
PackageLocale: defaultLocale,
|
PackageLocale: defaultLocale,
|
||||||
Publisher: winget.Publisher,
|
Publisher: winget.Publisher,
|
||||||
PublisherURL: winget.PublisherURL,
|
PublisherURL: winget.PublisherURL,
|
||||||
Author: winget.Author,
|
PublisherSupportURL: winget.PublisherSupportURL,
|
||||||
PackageName: winget.Name,
|
Author: winget.Author,
|
||||||
PackageURL: winget.Homepage,
|
PackageName: winget.Name,
|
||||||
License: winget.License,
|
PackageURL: winget.Homepage,
|
||||||
LicenseURL: winget.LicenseURL,
|
License: winget.License,
|
||||||
Copyright: winget.Copyright,
|
LicenseURL: winget.LicenseURL,
|
||||||
ShortDescription: winget.ShortDescription,
|
Copyright: winget.Copyright,
|
||||||
Description: winget.Description,
|
CopyrightURL: winget.CopyrightURL,
|
||||||
Moniker: winget.Name,
|
ShortDescription: winget.ShortDescription,
|
||||||
Tags: []string{},
|
Description: winget.Description,
|
||||||
ReleaseNotes: winget.ReleaseNotes,
|
Moniker: winget.Name,
|
||||||
ReleaseNotesURL: winget.ReleaseNotesURL,
|
Tags: winget.Tags,
|
||||||
ManifestType: "defaultLocale",
|
ReleaseNotes: winget.ReleaseNotes,
|
||||||
ManifestVersion: manifestVersion,
|
ReleaseNotesURL: winget.ReleaseNotesURL,
|
||||||
|
ManifestType: "defaultLocale",
|
||||||
|
ManifestVersion: manifestVersion,
|
||||||
}, artifact.WingetDefaultLocale)
|
}, artifact.WingetDefaultLocale)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -62,18 +62,20 @@ func TestRunPipe(t *testing.T) {
|
|||||||
name: "full",
|
name: "full",
|
||||||
expectPath: "manifests/b/Beckersoft LTDA/foo/1.2.1",
|
expectPath: "manifests/b/Beckersoft LTDA/foo/1.2.1",
|
||||||
winget: config.Winget{
|
winget: config.Winget{
|
||||||
Name: "foo",
|
Name: "foo",
|
||||||
Publisher: "Beckersoft",
|
Publisher: "Beckersoft",
|
||||||
PublisherURL: "https://carlosbecker.com",
|
PublisherURL: "https://carlosbecker.com",
|
||||||
Copyright: "bla bla bla",
|
PublisherSupportURL: "https://carlosbecker.com/support",
|
||||||
Author: "Carlos Becker",
|
Copyright: "bla bla bla",
|
||||||
Path: "manifests/b/Beckersoft LTDA/foo/{{.Version}}",
|
CopyrightURL: "https://goreleaser.com/copyright",
|
||||||
Repository: config.RepoRef{Owner: "foo", Name: "bar"},
|
Author: "Carlos Becker",
|
||||||
CommitAuthor: config.CommitAuthor{},
|
Path: "manifests/b/Beckersoft LTDA/foo/{{.Version}}",
|
||||||
IDs: []string{"foo"},
|
Repository: config.RepoRef{Owner: "foo", Name: "bar"},
|
||||||
Goamd64: "v1",
|
CommitAuthor: config.CommitAuthor{},
|
||||||
SkipUpload: "false",
|
IDs: []string{"foo"},
|
||||||
ShortDescription: "foo",
|
Goamd64: "v1",
|
||||||
|
SkipUpload: "false",
|
||||||
|
ShortDescription: "foo",
|
||||||
Description: `long foo bar
|
Description: `long foo bar
|
||||||
|
|
||||||
yadaa yada yada loooaaasssss
|
yadaa yada yada loooaaasssss
|
||||||
@@ -84,6 +86,7 @@ func TestRunPipe(t *testing.T) {
|
|||||||
LicenseURL: "https://goreleaser.com/eula/",
|
LicenseURL: "https://goreleaser.com/eula/",
|
||||||
ReleaseNotesURL: "https://github.com/goreleaser/goreleaser/tags/{{.Tag}}",
|
ReleaseNotesURL: "https://github.com/goreleaser/goreleaser/tags/{{.Tag}}",
|
||||||
ReleaseNotes: "{{.Changelog}}",
|
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",
|
name: "skip-upload",
|
||||||
expectPublishErrorIs: errSkipUpload,
|
expectPublishErrorIs: errSkipUpload,
|
||||||
|
@@ -266,7 +266,9 @@ type Winget struct {
|
|||||||
PackageIdentifier string `yaml:"package_identifier,omitempty" json:"package_identifier,omitempty"`
|
PackageIdentifier string `yaml:"package_identifier,omitempty" json:"package_identifier,omitempty"`
|
||||||
Publisher string `yaml:"publisher,omitempty" json:"publisher,omitempty"`
|
Publisher string `yaml:"publisher,omitempty" json:"publisher,omitempty"`
|
||||||
PublisherURL string `yaml:"publisher_url,omitempty" json:"publisher_url,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"`
|
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"`
|
Author string `yaml:"author,omitempty" json:"author,omitempty"`
|
||||||
Path string `yaml:"path,omitempty" json:"path,omitempty"`
|
Path string `yaml:"path,omitempty" json:"path,omitempty"`
|
||||||
Repository RepoRef `yaml:"repository,omitempty" json:"repository,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"`
|
LicenseURL string `yaml:"license_url,omitempty" json:"license_url,omitempty"`
|
||||||
ReleaseNotes string `yaml:"release_notes,omitempty" json:"release_notes,omitempty"`
|
ReleaseNotes string `yaml:"release_notes,omitempty" json:"release_notes,omitempty"`
|
||||||
ReleaseNotesURL string `yaml:"release_notes_url,omitempty" json:"release_notes_url,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.
|
// Krew contains the krew section.
|
||||||
|
@@ -30,6 +30,8 @@ winget:
|
|||||||
short_description: "Software to create fast and easy drum rolls."
|
short_description: "Software to create fast and easy drum rolls."
|
||||||
|
|
||||||
# License name.
|
# License name.
|
||||||
|
#
|
||||||
|
# Templates: allowed
|
||||||
# Required.
|
# Required.
|
||||||
license: "mit"
|
license: "mit"
|
||||||
|
|
||||||
@@ -38,6 +40,11 @@ winget:
|
|||||||
# Templates: allowed
|
# Templates: allowed
|
||||||
publisher_url: https://goreleaser.com
|
publisher_url: https://goreleaser.com
|
||||||
|
|
||||||
|
# Publisher support URL.
|
||||||
|
#
|
||||||
|
# Templates: allowed
|
||||||
|
publisher_support_url: "https://github.com/user/repo/issues/new"
|
||||||
|
|
||||||
# Package identifier.
|
# Package identifier.
|
||||||
#
|
#
|
||||||
# Default: Publisher.ProjectName
|
# Default: Publisher.ProjectName
|
||||||
@@ -86,11 +93,20 @@ winget:
|
|||||||
description: "Software to create fast and easy drum rolls."
|
description: "Software to create fast and easy drum rolls."
|
||||||
|
|
||||||
# License URL.
|
# License URL.
|
||||||
|
#
|
||||||
|
# Templates: allowed
|
||||||
license_url: "https://goreleaser.com/license"
|
license_url: "https://goreleaser.com/license"
|
||||||
|
|
||||||
# Copyright.
|
# Copyright.
|
||||||
|
#
|
||||||
|
# Templates: allowed
|
||||||
copyright: "Becker Software LTDA"
|
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
|
# Setting this will prevent goreleaser to actually try to commit the updated
|
||||||
# package - instead, it will be stored on the dist folder only,
|
# package - instead, it will be stored on the dist folder only,
|
||||||
# leaving the responsibility of publishing it to the user.
|
# leaving the responsibility of publishing it to the user.
|
||||||
@@ -114,6 +130,12 @@ winget:
|
|||||||
# Templates: allowed
|
# Templates: allowed
|
||||||
release_notes_url: "https://foo.bar/changelog/{{.Version}}"
|
release_notes_url: "https://foo.bar/changelog/{{.Version}}"
|
||||||
|
|
||||||
|
# Tags.
|
||||||
|
tags:
|
||||||
|
- golang
|
||||||
|
- cli
|
||||||
|
|
||||||
|
|
||||||
{% include-markdown "../includes/repository.md" comments=false %}
|
{% include-markdown "../includes/repository.md" comments=false %}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user