mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-02-07 13:31:37 +02:00
fix(winget): release notes should be optional
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
This commit is contained in:
parent
e525b66631
commit
2eaefa94b1
@ -19,6 +19,7 @@ Description: |-
|
||||
|
||||
sss
|
||||
Moniker: foo
|
||||
ReleaseNotes: the changelog for this release...
|
||||
ReleaseNotesUrl: https://github.com/goreleaser/goreleaser/tags/v1.2.1
|
||||
ManifestType: defaultLocale
|
||||
ManifestVersion: 1.4.0
|
||||
|
@ -102,7 +102,9 @@ func (p Pipe) doRun(ctx *context.Context, winget config.Winget, cl client.Releas
|
||||
return errNoRepoName
|
||||
}
|
||||
|
||||
publisher, err := tmpl.New(ctx).Apply(winget.Publisher)
|
||||
tp := tmpl.New(ctx)
|
||||
|
||||
publisher, err := tp.Apply(winget.Publisher)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -115,49 +117,49 @@ func (p Pipe) doRun(ctx *context.Context, winget config.Winget, cl client.Releas
|
||||
return errNoLicense
|
||||
}
|
||||
|
||||
name, err := tmpl.New(ctx).Apply(winget.Name)
|
||||
name, err := tp.Apply(winget.Name)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
winget.Name = name
|
||||
|
||||
author, err := tmpl.New(ctx).Apply(winget.Author)
|
||||
author, err := tp.Apply(winget.Author)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
winget.Author = author
|
||||
|
||||
publisherURL, err := tmpl.New(ctx).Apply(winget.PublisherURL)
|
||||
publisherURL, err := tp.Apply(winget.PublisherURL)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
winget.PublisherURL = publisherURL
|
||||
|
||||
homepage, err := tmpl.New(ctx).Apply(winget.Homepage)
|
||||
homepage, err := tp.Apply(winget.Homepage)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
winget.Homepage = homepage
|
||||
|
||||
ref, err := client.TemplateRef(tmpl.New(ctx).Apply, winget.Repository)
|
||||
ref, err := client.TemplateRef(tp.Apply, winget.Repository)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
winget.Repository = ref
|
||||
|
||||
skipUpload, err := tmpl.New(ctx).Apply(winget.SkipUpload)
|
||||
skipUpload, err := tp.Apply(winget.SkipUpload)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
winget.SkipUpload = skipUpload
|
||||
|
||||
description, err := tmpl.New(ctx).Apply(winget.Description)
|
||||
description, err := tp.Apply(winget.Description)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
winget.Description = description
|
||||
|
||||
shortDescription, err := tmpl.New(ctx).Apply(winget.ShortDescription)
|
||||
shortDescription, err := tp.Apply(winget.ShortDescription)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -167,12 +169,20 @@ func (p Pipe) doRun(ctx *context.Context, winget config.Winget, cl client.Releas
|
||||
return errNoShortDescription
|
||||
}
|
||||
|
||||
releaseNotesURL, err := tmpl.New(ctx).Apply(winget.ReleaseNotesURL)
|
||||
releaseNotesURL, err := tp.Apply(winget.ReleaseNotesURL)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
winget.ReleaseNotesURL = releaseNotesURL
|
||||
|
||||
releaseNotes, err := tp.WithExtraFields(tmpl.Fields{
|
||||
"Changelog": ctx.ReleaseNotes,
|
||||
}).Apply(winget.ReleaseNotes)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
winget.ReleaseNotes = releaseNotes
|
||||
|
||||
if winget.URLTemplate == "" {
|
||||
url, err := cl.ReleaseURLTemplate(ctx)
|
||||
if err != nil {
|
||||
@ -181,7 +191,7 @@ func (p Pipe) doRun(ctx *context.Context, winget config.Winget, cl client.Releas
|
||||
winget.URLTemplate = url
|
||||
}
|
||||
|
||||
path, err := tmpl.New(ctx).Apply(winget.Path)
|
||||
path, err := tp.Apply(winget.Path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -302,7 +312,7 @@ func (p Pipe) doRun(ctx *context.Context, winget config.Winget, cl client.Releas
|
||||
Description: description,
|
||||
Moniker: name,
|
||||
Tags: []string{},
|
||||
ReleaseNotes: ctx.ReleaseNotes,
|
||||
ReleaseNotes: winget.ReleaseNotes,
|
||||
ReleaseNotesURL: winget.ReleaseNotesURL,
|
||||
ManifestType: "defaultLocale",
|
||||
ManifestVersion: manifestVersion,
|
||||
|
@ -84,6 +84,7 @@ func TestRunPipe(t *testing.T) {
|
||||
License: "MIT",
|
||||
LicenseURL: "https://goreleaser.com/eula/",
|
||||
ReleaseNotesURL: "https://github.com/goreleaser/goreleaser/tags/{{.Tag}}",
|
||||
ReleaseNotes: "{{.Changelog}}",
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -478,6 +479,7 @@ func TestRunPipe(t *testing.T) {
|
||||
testctx.WithSemver(1, 2, 1, "rc1"),
|
||||
testctx.WithDate(time.Date(2023, 6, 12, 20, 32, 10, 12, time.Local)),
|
||||
)
|
||||
ctx.ReleaseNotes = "the changelog for this release..."
|
||||
createFakeArtifact := func(id, goos, goarch, goamd64, goarm string, extra map[string]any) {
|
||||
path := filepath.Join(folder, "dist/foo_"+goos+goarch+goamd64+goarm+".zip")
|
||||
art := artifact.Artifact{
|
||||
|
@ -281,6 +281,7 @@ type Winget struct {
|
||||
Homepage string `yaml:"homepage,omitempty" json:"homepage,omitempty"`
|
||||
License string `yaml:"license,omitempty" json:"license,omitempty"`
|
||||
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"`
|
||||
}
|
||||
|
||||
|
@ -101,6 +101,19 @@ winget:
|
||||
# Templates: allowed
|
||||
skip_upload: true
|
||||
|
||||
# Release notes.
|
||||
#
|
||||
# If you want to use the release notes generated by GoReleaser, use
|
||||
# `{{.Changelog}}` as the value.
|
||||
#
|
||||
# Templates: allowed
|
||||
release_notes: "{{.Changelog}}"
|
||||
|
||||
# Release notes URL.
|
||||
#
|
||||
# Templates: allowed
|
||||
release_notes_url: "https://foo.bar/changelog/{{.Version}}"
|
||||
|
||||
{% include-markdown "../includes/repository.md" comments=false %}
|
||||
```
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user