-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #128 from vitessio/change-vtop-process
Improve vtop release process by creating the Release PR first
- Loading branch information
Showing
12 changed files
with
533 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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))) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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))) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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))) | ||
} |
Oops, something went wrong.