diff --git a/go/interactive/release/website_docs.go b/go/interactive/release/website_docs.go index f75c424..8cb7d03 100644 --- a/go/interactive/release/website_docs.go +++ b/go/interactive/release/website_docs.go @@ -22,31 +22,50 @@ import ( tea "github.com/charmbracelet/bubbletea" "vitess.io/vitess-releaser/go/interactive/ui" "vitess.io/vitess-releaser/go/releaser" + "vitess.io/vitess-releaser/go/releaser/release" "vitess.io/vitess-releaser/go/releaser/steps" ) func WebsiteDocumentationItem(ctx context.Context) *ui.MenuItem { state := releaser.UnwrapState(ctx) act := websiteDocumentationAct - if state.Issue.WebsiteDocumentation.Done { - act = nil - } return &ui.MenuItem{ State: state, Name: steps.WebsiteDocumentation, Act: act, Update: websiteDocumentationUpdate, - Info: state.Issue.WebsiteDocumentation.URL, - IsDone: state.Issue.WebsiteDocumentation.Done, + IsDone: state.Issue.WebsiteDocumentation, } } -type websiteDocumentationUrl string +type websiteDocumentationMsg []string func websiteDocumentationUpdate(mi *ui.MenuItem, msg tea.Msg) (*ui.MenuItem, tea.Cmd) { + switch msg := msg.(type) { + case websiteDocumentationMsg: + return mi, ui.PushDialog(&ui.DoneDialog{ + StepName: mi.Name, + Title: steps.WebsiteDocumentation, + Message: msg, + IsDone: mi.IsDone, + }) + case ui.DoneDialogAction: + if string(msg) != mi.Name { + return mi, nil + } + mi.State.Issue.WebsiteDocumentation = !mi.State.Issue.WebsiteDocumentation + mi.IsDone = !mi.IsDone + pl, fn := mi.State.UploadIssue() + return mi, tea.Batch(func() tea.Msg { + fn() + return tea.Msg("") + }, ui.PushDialog(ui.NewProgressDialog("Updating the Release Issue", pl))) + } return mi, nil } func websiteDocumentationAct(mi *ui.MenuItem) (*ui.MenuItem, tea.Cmd) { - return mi, nil + return mi, func() tea.Msg { + return websiteDocumentationMsg(release.WebsiteDocs(mi.State)) + } } diff --git a/go/releaser/issue.go b/go/releaser/issue.go index 5602132..f66c19e 100644 --- a/go/releaser/issue.go +++ b/go/releaser/issue.go @@ -42,7 +42,6 @@ const ( stateReadingTagReleaseItem stateReadingReleaseNotesMainItem stateReadingBackToDevModeItem - stateReadingWebsiteDocsItem stateReadingCloseMilestoneItem stateReadingVtopUpdateGo stateReadingVtopCreateReleasePR @@ -50,7 +49,6 @@ const ( const ( markdownItemDone = "- [x]" - markdownItemToDo = "- [ ]" // Divers dateItem = "This release is scheduled for" @@ -135,7 +133,7 @@ type ( TagRelease ItemWithLink ReleaseNotesOnMain ItemWithLink BackToDevMode ItemWithLink - WebsiteDocumentation ItemWithLink + WebsiteDocumentation bool Benchmarked bool DockerImages bool CloseMilestone ItemWithLink @@ -232,10 +230,7 @@ The release of vitess-operator v{{.VtopRelease}} is also planned {{- if .BackToDevMode.URL }} - {{ .BackToDevMode.URL }} {{- end }} -- [{{fmtStatus .WebsiteDocumentation.Done}}] Update the website documentation. -{{- if .WebsiteDocumentation.URL }} - - {{ .WebsiteDocumentation.URL }} -{{- end }} +- [{{fmtStatus .WebsiteDocumentation}}] Update the website documentation. - [{{fmtStatus .Benchmarked}}] Make sure the release is benchmarked by arewefastyet. - [{{fmtStatus .DockerImages}}] Docker Images available on DockerHub. {{- if eq .RC 0 }} @@ -378,10 +373,7 @@ func (s *State) LoadIssue() { st = stateReadingBackToDevModeItem } case strings.Contains(line, websiteDocItem): - newIssue.WebsiteDocumentation.Done = strings.HasPrefix(line, markdownItemDone) - if isNextLineAList(lines, i) { - st = stateReadingWebsiteDocsItem - } + newIssue.WebsiteDocumentation = strings.HasPrefix(line, markdownItemDone) case strings.Contains(line, benchmarkedItem): newIssue.Benchmarked = strings.HasPrefix(line, markdownItemDone) case strings.Contains(line, dockerImagesItem): @@ -418,8 +410,6 @@ func (s *State) LoadIssue() { newIssue.ReleaseNotesOnMain.URL = handleSingleTextItem(line, &st) case stateReadingBackToDevModeItem: newIssue.BackToDevMode.URL = handleSingleTextItem(line, &st) - case stateReadingWebsiteDocsItem: - newIssue.WebsiteDocumentation.URL = handleSingleTextItem(line, &st) case stateReadingCloseMilestoneItem: newIssue.CloseMilestone.URL = handleSingleTextItem(line, &st) case stateReadingVtopUpdateGo: diff --git a/go/releaser/release/website_docs.go b/go/releaser/release/website_docs.go new file mode 100644 index 0000000..2b5b582 --- /dev/null +++ b/go/releaser/release/website_docs.go @@ -0,0 +1,43 @@ +/* +Copyright 2024 The Vitess Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package release + +import ( + "vitess.io/vitess-releaser/go/releaser" +) + +func WebsiteDocs(state *releaser.State) []string { + msg := []string{ + "We want to open a Pull Request to update the documentation.", + "There are several pages we want to update:", + "\t- https://vitess.io/docs/releases/: we must add the new release to the list with all its information and link.", + "\t- https://vitess.io/docs/get-started/local/: we must use the proper version increment for this guide and the proper SHA.", + "We must do a git checkout to the proper release branch after cloning Vitess on the following pages:", + "\t- https://vitess.io/docs/get-started/operator/#install-the-operator", + "\t- https://vitess.io/docs/get-started/local-mac/#install-vitess", + "\t- https://vitess.io/docs/get-started/local-docker/#check-out-the-vitessiovitess-repository", + "\t- https://vitess.io/docs/get-started/vttestserver-docker-image/#check-out-the-vitessiovitess-repository", + } + if state.Issue.RC > 0 { + msg = append(msg, []string{ + "", + "Since we are doing an RC release, we must use the ./tools/rc_release.sh script in the website repository to update the documentation even further.", + "The script creates a new entry in the sidebar which represents the next version on main and mark the version we are releasing as RC.", + }...) + } + return msg +}