5af107b06d
- GitHub release support: internal/ghclient (no SDK, minimal HTTP client); GITHUB_TOKEN env var; github.token/github.repo config; GitHub takes precedence over GitLab when both are configured; publisher interface (releasePublisher) in cmd/main.go makes providers interchangeable - SSH agent push: gitutil.Push() now tries gitssh.NewSSHAgentAuth for git@/ssh:// remotes before falling back to the system git binary - --release-env-file flag: override dotenv artifact path; pass "" to disable - git.releasable_types config: filter which commit types trigger a bump (defaults to fix, feat, breaking); useful for maintenance branches - commits.Group(), ExtractSubject(), ReleasableSet() exported helpers: notes.go and changelog.go now delegate to these instead of duplicating - CHANGELOG deduplication guard: changelog.Update() is idempotent — skips write if ## [version] section already exists - Always load config sources: LoadWithSources() called unconditionally; removes the dual config path that previously only tracked sources in --verbose mode - .releaser.gitlab-ci.yml: adds artifacts: reports: dotenv: release.env Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
34 lines
850 B
Go
34 lines
850 B
Go
package notes
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
|
|
"git.k3nny.fr/releaser/internal/commits"
|
|
)
|
|
|
|
// Generate produces grouped markdown release notes from a list of commit messages.
|
|
// Commits are grouped into Breaking Changes, Features, and Bug Fixes.
|
|
// Commits with no releasable type are omitted.
|
|
func Generate(tagName string, messages []string) string {
|
|
breaking, feats, fixes := commits.Group(messages)
|
|
|
|
var sb strings.Builder
|
|
fmt.Fprintf(&sb, "## %s\n", tagName)
|
|
writeSection(&sb, "Breaking Changes", breaking)
|
|
writeSection(&sb, "Features", feats)
|
|
writeSection(&sb, "Bug Fixes", fixes)
|
|
|
|
return strings.TrimRight(sb.String(), "\n")
|
|
}
|
|
|
|
func writeSection(sb *strings.Builder, title string, items []string) {
|
|
if len(items) == 0 {
|
|
return
|
|
}
|
|
fmt.Fprintf(sb, "\n### %s\n", title)
|
|
for _, item := range items {
|
|
fmt.Fprintf(sb, "- %s\n", item)
|
|
}
|
|
}
|