1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-06 03:13:48 +02:00

feat: template nfpms.maintainer (#2872)

This commit is contained in:
Carlos Alexandro Becker 2022-02-02 15:39:44 -03:00 committed by GitHub
parent 8db78f68a2
commit f3743ed66b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 2 deletions

View File

@ -147,6 +147,11 @@ func create(ctx *context.Context, fpm config.NFPM, format string, binaries []*ar
return err
}
maintainer, err := t.Apply(fpm.Maintainer)
if err != nil {
return err
}
debKeyFile, err := t.Apply(overridden.Deb.Signature.KeyFile)
if err != nil {
return err
@ -209,7 +214,7 @@ func create(ctx *context.Context, fpm config.NFPM, format string, binaries []*ar
Release: fpm.Release,
Prerelease: fpm.Prerelease,
VersionMetadata: fpm.VersionMetadata,
Maintainer: fpm.Maintainer,
Maintainer: maintainer,
Description: description,
Vendor: fpm.Vendor,
Homepage: homepage,

View File

@ -331,6 +331,12 @@ func TestInvalidTemplate(t *testing.T) {
require.Contains(t, Pipe{}.Run(ctx).Error(), `template: tmpl:1:3: executing "tmpl" at <.NOPE_DESC>: map has no entry for key "NOPE_DESC"`)
})
t.Run("maintainer", func(t *testing.T) {
ctx := makeCtx()
ctx.Config.NFPMs[0].Maintainer = "{{ .NOPE_DESC }}"
require.Contains(t, Pipe{}.Run(ctx).Error(), `template: tmpl:1:3: executing "tmpl" at <.NOPE_DESC>: map has no entry for key "NOPE_DESC"`)
})
t.Run("homepage", func(t *testing.T) {
ctx := makeCtx()
ctx.Config.NFPMs[0].Homepage = "{{ .NOPE_HOMEPAGE }}"
@ -1148,6 +1154,7 @@ func TestBinDirTemplating(t *testing.T) {
Env: []string{
"PRO=pro",
"DESC=templates",
"MAINTAINER=me@me",
},
NFPMs: []config.NFPM{
{
@ -1160,7 +1167,7 @@ func TestBinDirTemplating(t *testing.T) {
Priority: "standard",
Description: "Some description with {{ .Env.DESC }}",
License: "MIT",
Maintainer: "me@me",
Maintainer: "{{ .Env.MAINTAINER }}",
Vendor: "asdf",
Homepage: "https://goreleaser.com/{{ .Env.PRO }}",
NFPMOverridables: config.NFPMOverridables{