shithub: hugo

Download patch

ref: 2c7c361091618868581c4a02352e7c37ccc12753
parent: c62bbf7b11d68d52ef11a4c6c70660914c473d08
author: Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
date: Tue Jul 30 05:02:03 EDT 2019

releaser: Create a proper automated title for patch releases

Fixes #6126

--- a/releaser/releasenotes_writer.go
+++ b/releaser/releasenotes_writer.go
@@ -272,7 +272,7 @@
 
 }
 
-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 @@
 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
 	}
 
--- a/releaser/releaser.go
+++ b/releaser/releaser.go
@@ -95,6 +95,8 @@
 	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 @@
 
 	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
 	}