releaser: Create a proper automated title for patch releases

Fixes #6126
This commit is contained in:
Bjørn Erik Pedersen 2019-07-30 09:02:03 +02:00
parent c62bbf7b11
commit 2c7c361091
No known key found for this signature in database
GPG key ID: 330E6E2BD4859D8F
2 changed files with 11 additions and 3 deletions

View file

@ -272,7 +272,7 @@ func (r *ReleaseHandler) writeReleaseNotesToTemp(version string, isPatch bool, i
}
func (r *ReleaseHandler) writeReleaseNotesToDocs(title, sourceFilename string) (string, error) {
func (r *ReleaseHandler) writeReleaseNotesToDocs(title, description, sourceFilename string) (string, error) {
targetFilename := "index.md"
bundleDir := strings.TrimSuffix(filepath.Base(sourceFilename), "-ready.md")
contentDir := hugoFilepath("docs/content/en/news/" + bundleDir)
@ -315,7 +315,7 @@ description: %q
categories: ["Releases"]%s
---
`, time.Now().Format("2006-01-02"), title, title, fmTail)); err != nil {
`, time.Now().Format("2006-01-02"), title, description, fmTail)); err != nil {
return "", err
}

View file

@ -95,6 +95,8 @@ func (r *ReleaseHandler) Run() error {
version := newVersion.String()
tag := "v" + version
isPatch := newVersion.PatchLevel > 0
mainVersion := newVersion
mainVersion.PatchLevel = 0
// Exit early if tag already exists
exists, err := tagExists(tag)
@ -193,8 +195,14 @@ func (r *ReleaseHandler) Run() error {
releaseNotesFile := getReleaseNotesDocsTempFilename(version, true)
title, description := version, version
if isPatch {
title = "Hugo " + version + ": A couple of Bug Fixes"
description = "This version fixes a couple of bugs introduced in " + mainVersion.String() + "."
}
// Write the release notes to the docs site as well.
docFile, err := r.writeReleaseNotesToDocs(version, releaseNotesFile)
docFile, err := r.writeReleaseNotesToDocs(title, description, releaseNotesFile)
if err != nil {
return err
}