1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-26 04:22:05 +02:00
Frank Schroeder 0780c232fc
feat: allow env vars for checksum name_template
Allow env vars for the checksum name_template.
2017-12-17 22:54:07 +01:00

29 lines
584 B
Go

package checksums
import (
"bytes"
"text/template"
"github.com/goreleaser/goreleaser/context"
)
func filenameFor(ctx *context.Context) (string, error) {
var out bytes.Buffer
t, err := template.New("checksums").Parse(ctx.Config.Checksum.NameTemplate)
if err != nil {
return "", err
}
err = t.Execute(&out, struct {
ProjectName string
Tag string
Version string
Env map[string]string
}{
ProjectName: ctx.Config.ProjectName,
Tag: ctx.Git.CurrentTag,
Version: ctx.Version,
Env: ctx.Env,
})
return out.String(), err
}