1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-11-06 09:09:29 +02:00

feat: Allow release notes to be used in template strings (#2566)

When using the announce feature, you might want to inform your users about the features and changes that this release brings. This change allows you to use {{ .ReleaseNotes }} in any template string, after the changelog pipeline step has been executed.
This commit is contained in:
Patrick Hahn
2021-10-07 19:19:19 +02:00
committed by GitHub
parent d32454e279
commit e64b2cd8da
3 changed files with 5 additions and 0 deletions

View File

@@ -46,6 +46,7 @@ const (
date = "Date"
timestamp = "Timestamp"
modulePath = "ModulePath"
releaseNotes = "ReleaseNotes"
// artifact-only keys.
osKey = "Os"
@@ -90,6 +91,7 @@ func New(ctx *context.Context) *Template {
patch: ctx.Semver.Patch,
prerelease: ctx.Semver.Prerelease,
isSnapshot: ctx.Snapshot,
releaseNotes: ctx.ReleaseNotes,
},
}
}

View File

@@ -32,6 +32,7 @@ func TestWithArtifact(t *testing.T) {
ctx.Git.Commit = "commit"
ctx.Git.FullCommit = "fullcommit"
ctx.Git.ShortCommit = "shortcommit"
ctx.ReleaseNotes = "test release notes"
for expect, tmpl := range map[string]string{
"bar": "{{.Env.FOO}}",
"Linux": "{{.Os}}",
@@ -54,6 +55,7 @@ func TestWithArtifact(t *testing.T) {
"1.3.0": "{{.Version | incminor }}",
"v1.2.4": "{{.Tag | incpatch }}",
"1.2.4": "{{.Version | incpatch }}",
"test release notes": "{{ .ReleaseNotes }}",
} {
tmpl := tmpl
expect := expect