shithub: hugo

Download patch

ref: 8dc77b84a5776894b06698be9e129eea12911097
parent: 4560261b58bae36316c525a43fee1e027705e92b
author: Bjørn Erik Pedersen <[email protected]>
date: Wed Feb 21 05:22:08 EST 2018

releaser: Create bundles for the release notes

Fixes #4413

--- a/releaser/releasenotes_writer.go
+++ b/releaser/releasenotes_writer.go
@@ -260,15 +260,19 @@
 }
 
 func (r *ReleaseHandler) writeReleaseNotesToDocs(title, sourceFilename string) (string, error) {
-	targetFilename := filepath.Base(sourceFilename)
-	contentDir := hugoFilepath("docs/content/news")
+	targetFilename := "index.md"
+	bundleDir := strings.TrimSuffix(filepath.Base(sourceFilename), "-ready.md")
+	contentDir := hugoFilepath("docs/content/news/" + bundleDir)
 	targetFullFilename := filepath.Join(contentDir, targetFilename)
 
 	if r.try {
+		fmt.Printf("Write release notes to /docs: Bundle %q Dir: %q\n", bundleDir, contentDir)
 		return targetFullFilename, nil
 	}
 
-	os.Mkdir(contentDir, os.ModePerm)
+	if err := os.MkdirAll(contentDir, os.ModePerm); err != nil {
+		return "", nil
+	}
 
 	b, err := ioutil.ReadFile(sourceFilename)
 	if err != nil {