releaser: Simplify the release process

Make it into a one step even for major releases.
This commit is contained in:
Bjørn Erik Pedersen
2021-12-08 09:23:18 +01:00
parent bf537f1c6d
commit 0fa40ce58f
2 changed files with 41 additions and 103 deletions

View File

@@ -163,54 +163,22 @@ func fetchThemeCount() (int, error) {
return bytes.Count(b, []byte("\n")) - bytes.Count(b, []byte("#")), nil
}
func getReleaseNotesDocsTempDirAndName(version string, final bool) (string, string) {
if final {
return hugoFilepath("temp"), fmt.Sprintf("%s-relnotes-ready.md", version)
}
return hugoFilepath("temp"), fmt.Sprintf("%s-relnotes.md", version)
}
func getReleaseNotesFilename(version string) string {
return filepath.FromSlash(fmt.Sprintf("temp/%s-relnotes-ready.md", version))
func getReleaseNotesDocsTempFilename(version string, final bool) string {
return filepath.Join(getReleaseNotesDocsTempDirAndName(version, final))
}
func (r *ReleaseHandler) releaseNotesState(version string) (releaseNotesState, error) {
docsTempPath, name := getReleaseNotesDocsTempDirAndName(version, false)
_, err := os.Stat(filepath.Join(docsTempPath, name))
if err == nil {
return releaseNotesCreated, nil
}
docsTempPath, name = getReleaseNotesDocsTempDirAndName(version, true)
_, err = os.Stat(filepath.Join(docsTempPath, name))
if err == nil {
return releaseNotesReady, nil
}
if !os.IsNotExist(err) {
return releaseNotesNone, err
}
return releaseNotesNone, nil
}
func (r *ReleaseHandler) writeReleaseNotesToTemp(version string, isPatch bool, infosMain, infosDocs gitInfos) (string, error) {
docsTempPath, name := getReleaseNotesDocsTempDirAndName(version, isPatch)
filename := getReleaseNotesFilename(version)
var w io.WriteCloser
if !r.try {
os.Mkdir(docsTempPath, os.ModePerm)
f, err := os.Create(filepath.Join(docsTempPath, name))
f, err := os.Create(filename)
if err != nil {
return "", err
}
name = f.Name()
defer f.Close()
w = f
@@ -223,5 +191,5 @@ func (r *ReleaseHandler) writeReleaseNotesToTemp(version string, isPatch bool, i
return "", err
}
return name, nil
return filename, nil
}