1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-02-07 13:31:37 +02:00

feat: added IsNightly to OSS template variables

This should make it easier to use the same config file with both oss and
pro versions when only the nightly feature is used, e.g. in #3501.

Currently, that would fail because `IsNightly` is not a template field,
so you won't really be able to do it without keeping a second
`.goreleaser.yml` file. With this change, `IsNightly` always eval to
false on OSS, and keeps working as before on Pro.
This commit is contained in:
Carlos Alexandro Becker 2023-06-06 01:07:26 -03:00
parent de599666b8
commit b1c8e9f25b
No known key found for this signature in database
GPG Key ID: E61E2F7DC14AB940
2 changed files with 3 additions and 0 deletions

View File

@ -51,6 +51,7 @@ const (
patch = "Patch"
prerelease = "Prerelease"
isSnapshot = "IsSnapshot"
isNightly = "IsNightly"
isDraft = "IsDraft"
env = "Env"
date = "Date"
@ -109,6 +110,7 @@ func New(ctx *context.Context) *Template {
patch: ctx.Semver.Patch,
prerelease: ctx.Semver.Prerelease,
isSnapshot: ctx.Snapshot,
isNightly: false,
isDraft: ctx.Config.Release.Draft,
releaseNotes: ctx.ReleaseNotes,
releaseURL: ctx.ReleaseURL,

View File

@ -88,6 +88,7 @@ func TestWithArtifact(t *testing.T) {
"2023-03-09T02:06:02Z": `{{ .Date }}`,
"1678327562": `{{ .Timestamp }}`,
"snapshot true": `snapshot {{.IsSnapshot}}`,
"nightly false": `nightly {{.IsNightly}}`,
"draft true": `draft {{.IsDraft}}`,
"dirty true": `dirty {{.IsGitDirty}}`,