mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-20 21:31:32 +02:00
releaser: Fix tag detection for changelog when doing a main release
Also improve the changelog slightly. Fixes #3482
This commit is contained in:
committed by
GitHub
parent
a59525b05b
commit
4d1989d59c
@@ -24,7 +24,6 @@ import (
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"github.com/spf13/hugo/helpers"
|
||||
)
|
||||
@@ -89,20 +88,31 @@ func (r *ReleaseHandler) Run() error {
|
||||
tag := "v" + version
|
||||
|
||||
// Exit early if tag already exists
|
||||
out, err := git("tag", "-l", tag)
|
||||
|
||||
exists, err := tagExists(tag)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if strings.Contains(out, tag) {
|
||||
if exists {
|
||||
return fmt.Errorf("Tag %q already exists", tag)
|
||||
}
|
||||
|
||||
var changeLogFromTag string
|
||||
|
||||
if newVersion.PatchLevel == 0 {
|
||||
// There may have been patch releases inbetween, so set the tag explicitly.
|
||||
changeLogFromTag = "v" + newVersion.Prev().String()
|
||||
exists, _ := tagExists(changeLogFromTag)
|
||||
if !exists {
|
||||
// fall back to one that exists.
|
||||
changeLogFromTag = ""
|
||||
}
|
||||
}
|
||||
|
||||
var gitCommits gitInfos
|
||||
|
||||
if r.shouldPrepare() || r.shouldRelease() {
|
||||
gitCommits, err = getGitInfos(true)
|
||||
gitCommits, err = getGitInfos(changeLogFromTag, true)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
Reference in New Issue
Block a user