You've already forked goreleaser
							
							
				mirror of
				https://github.com/goreleaser/goreleaser.git
				synced 2025-10-30 23:58:09 +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:
		| @@ -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, | ||||
|   | ||||
| @@ -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}}`, | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user