-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question: Making it clear to goreleaser whether there are breaking changes #5
Comments
May be bale to do something like: diff --git pkg/hooks/goreleaser.go pkg/hooks/goreleaser.go
index 8308c68..550c62e 100644
--- pkg/hooks/goreleaser.go
+++ pkg/hooks/goreleaser.go
@@ -67,6 +67,15 @@ func (gr *GoReleaser) Success(shConfig *hooks.SuccessHookConfig) error {
FullCommit: currentSha,
ShortCommit: currentSha,
}
+ isBreaking := false
+
+ for _, c := range shConfig.GetCommits() {
+ if c.Change.Major {
+ isBreaking = true
+ break
+ }
+ }
+ // TODO: set environment variable
repo := config.Repo{
Owner: shConfig.RepoInfo.Owner,
@@ -88,6 +97,7 @@ func (gr *GoReleaser) Success(shConfig *hooks.SuccessHookConfig) error {
ctx.Config.Release.NameTemplate = ctx.Git.CurrentTag
ctx.PreRelease = gr.prerelease
ctx.Config.Release.Draft = false // always disable drafts
+ ctx.Env["GOSEMREL_BREAKING"] = fmt.Sprintf("%t", isBreaking)
for _, pipe := range pipeline.Pipeline {
if _, ok := pipe.(git.Pipe); ok {
|
|
jamietanna
added a commit
to jamietanna/hooks-goreleaser
that referenced
this issue
Jan 18, 2024
As noted in go-semantic-release#5, it would be useful for Goreleaser templates to be able to understand the different semver changes introduced in the release. This exposes a variable if the change is detected, allowing a consumer to use something like the below to conditionally handle the presence (and non-zero contents), such as: {{ if .Env.GOSEMREL_MAJOR }} ... {{ end }} Closes go-semantic-release#5.
christophwitzko
pushed a commit
that referenced
this issue
Jan 18, 2024
As noted in #5, it would be useful for Goreleaser templates to be able to understand the different semver changes introduced in the release. This exposes a variable if the change is detected, allowing a consumer to use something like the below to conditionally handle the presence (and non-zero contents), such as: {{ if .Env.GOSEMREL_MAJOR }} ... {{ end }} Closes #5.
Thanks again for taking care of this. |
You're welcome, thanks for a speedy release 🚀 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Related to / duplicate of go-semantic-release/semantic-release#171
How would it be possible to detect something within the release notes / a breaking change introduced? It appears that the
{{ .ReleaseNotes }}
variable for goreleaser has no value when using this hook.The text was updated successfully, but these errors were encountered: