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

Improve vtop release process by creating the Release PR first #128

Merged
merged 8 commits into from
Nov 9, 2024
6 changes: 4 additions & 2 deletions go/interactive/main_menu.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ func MainScreen(ctx context.Context, state *releaser.State) {
release.TagReleaseItem(ctx),
release.JavaReleaseItem(ctx),
release.VtopCreateReleasePRMenuItem(ctx),
release.VtopManualUpdateItem(ctx),
release.ReleaseNotesOnMainItem(ctx),
release.BackToDevModeItem(ctx),
mergeBlogPostPRMenuItem(ctx),
Expand All @@ -89,8 +88,11 @@ func MainScreen(ctx context.Context, state *releaser.State) {
dockerImagesItem(ctx),
release.CloseMilestoneItem(ctx),
simpleMenuItem(ctx, "ReleaseArtifacts", releaselogic.CheckArtifacts(state), steps.ReleaseArtifacts, false),
release.VtopMergeReleasePRItem(ctx),
release.VtopTagReleaseMenuItem(ctx),
release.VtopBackToDevModeItem(ctx),
release.VtopManualUpdateItem(ctx),
)
releaseMenu.Sequential = true

postReleaseMenu := ui.NewMenu(
ctx,
Expand Down
65 changes: 65 additions & 0 deletions go/interactive/release/vtop_back_to_dev.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*
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 (
"context"

tea "github.com/charmbracelet/bubbletea"
"github.com/vitessio/vitess-releaser/go/interactive/ui"
"github.com/vitessio/vitess-releaser/go/releaser"
"github.com/vitessio/vitess-releaser/go/releaser/release"
"github.com/vitessio/vitess-releaser/go/releaser/steps"
)

func VtopBackToDevModeItem(ctx context.Context) *ui.MenuItem {
state := releaser.UnwrapState(ctx)
act := vtopBackToDevAct
if state.Issue.VtopBackToDevMode.Done {
act = nil
}
return &ui.MenuItem{
State: state,
Name: steps.VtopBackToDev,
Act: act,
Update: vtopBackToDevUpdate,
IsDone: state.Issue.VtopBackToDevMode.Done,
Info: state.Issue.VtopBackToDevMode.URL,

Ignore: state.VtOpRelease.Release == "",
}
}

type vtopBackToDevUrl string

func vtopBackToDevUpdate(mi *ui.MenuItem, msg tea.Msg) (*ui.MenuItem, tea.Cmd) {
_, ok := msg.(vtopBackToDevUrl)
if !ok {
return mi, nil
}

mi.IsDone = mi.State.Issue.VtopBackToDevMode.Done
mi.Info = mi.State.Issue.VtopBackToDevMode.URL
return mi, nil
}

func vtopBackToDevAct(mi *ui.MenuItem) (*ui.MenuItem, tea.Cmd) {
pl, act := release.VtopBackToDev(mi.State)
return mi, tea.Batch(func() tea.Msg {
return vtopBackToDevUrl(act())
}, ui.PushDialog(ui.NewProgressDialog(steps.VtopBackToDev, pl)))
}
5 changes: 2 additions & 3 deletions go/interactive/release/vtop_create_release_pr.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package release

import (
"context"
"strings"

tea "github.com/charmbracelet/bubbletea"
"github.com/vitessio/vitess-releaser/go/interactive/ui"
Expand All @@ -39,7 +38,7 @@ func VtopCreateReleasePRMenuItem(ctx context.Context) *ui.MenuItem {
Act: act,
Update: vtopCreateReleasePRUpdate,
IsDone: state.Issue.VtopCreateReleasePR.Done,
Info: strings.Join(state.Issue.VtopCreateReleasePR.URLs, " | "),
Info: state.Issue.VtopCreateReleasePR.URL,

Ignore: state.VtOpRelease.Release == "",
}
Expand All @@ -54,7 +53,7 @@ func vtopCreateReleasePRUpdate(mi *ui.MenuItem, msg tea.Msg) (*ui.MenuItem, tea.
}

mi.IsDone = mi.State.Issue.VtopCreateReleasePR.Done
mi.Info = strings.Join(mi.State.Issue.VtopCreateReleasePR.URLs, " | ")
mi.Info = mi.State.Issue.VtopCreateReleasePR.URL
return mi, nil
}

Expand Down
75 changes: 75 additions & 0 deletions go/interactive/release/vtop_merge_release_pr.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/*
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 (
"context"

tea "github.com/charmbracelet/bubbletea"
"github.com/vitessio/vitess-releaser/go/interactive/ui"
"github.com/vitessio/vitess-releaser/go/releaser"
"github.com/vitessio/vitess-releaser/go/releaser/release"
"github.com/vitessio/vitess-releaser/go/releaser/steps"
)

func VtopMergeReleasePRItem(ctx context.Context) *ui.MenuItem {
state := releaser.UnwrapState(ctx)
act := vtopMergeReleasePRAct
if state.Issue.VtopMergeReleasePR.Done {
act = nil
}

info := "Run this step once the Release Pull Request was created."
if state.Issue.VtopCreateReleasePR.URL != "" {
info = state.Issue.VtopCreateReleasePR.URL
}

return &ui.MenuItem{
State: state,
Name: steps.VtopMergeReleasePR,
Act: act,
Update: vtopMergeReleasePRUpdate,
IsDone: state.Issue.VtopMergeReleasePR.Done,
Info: info,

Ignore: state.VtOpRelease.Release == "",
}
}

type vtopMergeReleasePRUrl string

func vtopMergeReleasePRUpdate(mi *ui.MenuItem, msg tea.Msg) (*ui.MenuItem, tea.Cmd) {
_, ok := msg.(vtopMergeReleasePRUrl)
if !ok {
return mi, nil
}

mi.IsDone = mi.State.Issue.VtopMergeReleasePR.Done
mi.Info = mi.State.Issue.VtopMergeReleasePR.URL
return mi, nil
}

func vtopMergeReleasePRAct(mi *ui.MenuItem) (*ui.MenuItem, tea.Cmd) {
if mi.State.Issue.VtopCreateReleasePR.URL == "" {
return mi, nil
}

pl, act := release.VtopMergeReleasePR(mi.State)
return mi, tea.Batch(func() tea.Msg {
return vtopMergeReleasePRUrl(act())
}, ui.PushDialog(ui.NewProgressDialog(steps.VtopMergeReleasePR, pl)))
}
65 changes: 65 additions & 0 deletions go/interactive/release/vtop_tag_release.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*
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 (
"context"

tea "github.com/charmbracelet/bubbletea"
"github.com/vitessio/vitess-releaser/go/interactive/ui"
"github.com/vitessio/vitess-releaser/go/releaser"
"github.com/vitessio/vitess-releaser/go/releaser/release"
"github.com/vitessio/vitess-releaser/go/releaser/steps"
)

func VtopTagReleaseMenuItem(ctx context.Context) *ui.MenuItem {
state := releaser.UnwrapState(ctx)
act := vtopTagReleaseAct
if state.Issue.VtopTagRelease.Done {
act = nil
}
return &ui.MenuItem{
State: state,
Name: steps.VtopTagRelease,
Act: act,
Update: vtopTagReleaseUpdate,
IsDone: state.Issue.VtopTagRelease.Done,
Info: state.Issue.VtopTagRelease.URL,

Ignore: state.VtOpRelease.Release == "",
}
}

type vtopTagReleaseUrl string

func vtopTagReleaseUpdate(mi *ui.MenuItem, msg tea.Msg) (*ui.MenuItem, tea.Cmd) {
_, ok := msg.(vtopTagReleaseUrl)
if !ok {
return mi, nil
}

mi.IsDone = mi.State.Issue.VtopTagRelease.Done
mi.Info = mi.State.Issue.VtopTagRelease.URL
return mi, nil
}

func vtopTagReleaseAct(mi *ui.MenuItem) (*ui.MenuItem, tea.Cmd) {
pl, act := release.VtopTagRelease(mi.State)
return mi, tea.Batch(func() tea.Msg {
return vtopTagReleaseUrl(act())
}, ui.PushDialog(ui.NewProgressDialog(steps.VtopTagRelease, pl)))
}
Loading