Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-organize the releasenotes directory into changelog #12566

Merged
merged 12 commits into from
Mar 20, 2023
Prev Previous commit
Next Next commit
generate the release notes in the proper place
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
  • Loading branch information
frouioui committed Mar 7, 2023
commit e246306ee83a41a32fc3da9df5b19dd85e662245
22 changes: 17 additions & 5 deletions go/tools/release-notes/release_notes.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,13 @@ type (
}
)

const (
releaseNotesPath = `doc/releasenotes/`
releaseNotesPathGitHub = `https://github.com/vitessio/vitess/blob/main/` + releaseNotesPath
var (
releaseNotesPath = `changelog/`
)

markdownTemplate = `# Release of Vitess {{.Version}}
const (
releaseNotesPathGitHub = `https://github.com/vitessio/vitess/blob/main/`
markdownTemplate = `# Release of Vitess {{.Version}}

{{- if or .Announcement .AddDetails }}
{{ .Announcement }}
Expand Down Expand Up @@ -138,7 +140,7 @@ The entire changelog for this release can be found [here]({{ .PathToChangeLogFil
func (rn *releaseNote) generate(rnFile, changelogFile *os.File) error {
var err error
// Generate the release notes
rn.PathToChangeLogFileOnGH = fmt.Sprintf(releaseNotesPathGitHub+"%s_changelog.md", rn.VersionUnderscore)
rn.PathToChangeLogFileOnGH = fmt.Sprintf(releaseNotesPathGitHub+releaseNotesPath+"%s_changelog.md", rn.VersionUnderscore)
if rnFile == nil {
rnFile, err = os.OpenFile(fmt.Sprintf(path.Join(releaseNotesPath, "%s_release_notes.md"), rn.VersionUnderscore), os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0666)
if err != nil {
Expand Down Expand Up @@ -506,6 +508,16 @@ func main() {
log.Fatal("The --version flag must be set using a valid format. Format: 'vX.X.X'.")
}

// Define the path to the release notes folder
majorVersion := versionMatch[1] + "." + versionMatch[2]
patchVersion := versionMatch[0]
releaseNotesPath = path.Join(releaseNotesPath, majorVersion, patchVersion)

err := os.MkdirAll(releaseNotesPath, os.ModePerm)
if err != nil {
log.Fatal(err)
}

releaseNotes := releaseNote{
Version: versionName,
VersionUnderscore: fmt.Sprintf("%s_%s_%s", versionMatch[1], versionMatch[2], versionMatch[3]), // v14.0.0 -> 14_0_0, this is used to format filenames.
Expand Down