You've already forked goreleaser
mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-11-06 09:09:29 +02:00
feat: add support for git branch in templates (#1906)
Add a `.Branch` field to the text templates populated by the current git branch. Signed-off-by: Ben Kochie <superq@gmail.com> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
@@ -29,6 +29,7 @@ const (
|
||||
version = "Version"
|
||||
rawVersion = "RawVersion"
|
||||
tag = "Tag"
|
||||
branch = "Branch"
|
||||
commit = "Commit"
|
||||
shortCommit = "ShortCommit"
|
||||
fullCommit = "FullCommit"
|
||||
@@ -74,6 +75,7 @@ func New(ctx *context.Context) *Template {
|
||||
version: ctx.Version,
|
||||
rawVersion: rawVersionV,
|
||||
tag: ctx.Git.CurrentTag,
|
||||
branch: ctx.Git.Branch,
|
||||
commit: ctx.Git.Commit,
|
||||
shortCommit: ctx.Git.ShortCommit,
|
||||
fullCommit: ctx.Git.FullCommit,
|
||||
|
||||
@@ -26,6 +26,7 @@ func TestWithArtifact(t *testing.T) {
|
||||
Minor: 2,
|
||||
Patch: 3,
|
||||
}
|
||||
ctx.Git.Branch = "test-branch"
|
||||
ctx.Git.Commit = "commit"
|
||||
ctx.Git.FullCommit = "fullcommit"
|
||||
ctx.Git.ShortCommit = "shortcommit"
|
||||
@@ -38,6 +39,7 @@ func TestWithArtifact(t *testing.T) {
|
||||
"1.2.3": "{{.Version}}",
|
||||
"v1.2.3": "{{.Tag}}",
|
||||
"1-2-3": "{{.Major}}-{{.Minor}}-{{.Patch}}",
|
||||
"test-branch": "{{.Branch}}",
|
||||
"commit": "{{.Commit}}",
|
||||
"fullcommit": "{{.FullCommit}}",
|
||||
"shortcommit": "{{.ShortCommit}}",
|
||||
|
||||
Reference in New Issue
Block a user