mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-28 21:21:40 -05:00
releaser: Create a proper automated title for patch releases
Fixes #6126
This commit is contained in:
parent
c62bbf7b11
commit
2c7c361091
2 changed files with 11 additions and 3 deletions
|
@ -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"
|
targetFilename := "index.md"
|
||||||
bundleDir := strings.TrimSuffix(filepath.Base(sourceFilename), "-ready.md")
|
bundleDir := strings.TrimSuffix(filepath.Base(sourceFilename), "-ready.md")
|
||||||
contentDir := hugoFilepath("docs/content/en/news/" + bundleDir)
|
contentDir := hugoFilepath("docs/content/en/news/" + bundleDir)
|
||||||
|
@ -315,7 +315,7 @@ description: %q
|
||||||
categories: ["Releases"]%s
|
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
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -95,6 +95,8 @@ func (r *ReleaseHandler) Run() error {
|
||||||
version := newVersion.String()
|
version := newVersion.String()
|
||||||
tag := "v" + version
|
tag := "v" + version
|
||||||
isPatch := newVersion.PatchLevel > 0
|
isPatch := newVersion.PatchLevel > 0
|
||||||
|
mainVersion := newVersion
|
||||||
|
mainVersion.PatchLevel = 0
|
||||||
|
|
||||||
// Exit early if tag already exists
|
// Exit early if tag already exists
|
||||||
exists, err := tagExists(tag)
|
exists, err := tagExists(tag)
|
||||||
|
@ -193,8 +195,14 @@ func (r *ReleaseHandler) Run() error {
|
||||||
|
|
||||||
releaseNotesFile := getReleaseNotesDocsTempFilename(version, true)
|
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.
|
// 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 {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue