now fix the tags

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-01-31 06:53:20 -06:00
parent 4d38d78b0d
commit eea6a138cb
2 changed files with 51 additions and 26 deletions

View File

@ -2,6 +2,8 @@
package main
import (
"path/filepath"
"go.wit.com/log"
)
@ -11,7 +13,6 @@ func (r *repo) lookToUnwind() bool {
currentS := r.status.GetCurrentBranchVersion()
log.Info("repo:", r.String(), goSumS, dirtyS, r.lastTag.String(), currentS)
curName := r.status.GetCurrentBranchName()
mName := r.status.GetMasterBranchName()
@ -29,12 +30,28 @@ func (r *repo) lookToUnwind() bool {
return false
}
if "v" + release.versionS != r.lastTag.String() {
if "v"+release.versionS != r.lastTag.String() {
log.Info("\trepo version mismatch last vs official", r.lastTag.String(), "!=", release.versionS)
r.setGoSumStatus("CAN NOT UNWIND")
return false
}
r.setGoSumStatus("UNWIND")
return true
fullpath := filepath.Join(me.goSrcPwd.String(), r.String())
testf := filepath.Join(fullpath, "go.mod")
if Exists(testf) {
log.Info("\trepo is ready. go.mod exists")
r.setGoSumStatus("UNWIND")
return true
}
fullpath = filepath.Join(me.goSrcPwd.String(), r.String())
testf = filepath.Join(fullpath, "go.sum")
if Exists(testf) {
log.Info("\trepo is ready. go.sum exists")
r.setGoSumStatus("UNWIND")
return true
}
r.setGoSumStatus("NO UNWIND?")
return false
}

View File

@ -17,7 +17,7 @@ func createUnreleaseBox(box *gui.Node) {
log.Info("skipping whitelist", repo.String())
continue
}
if repo.lookToUnwind() {
log.Info("found something to unwind:", repo.String())
if setCurrentRepo(repo, "rewind this", "very sure") {
@ -28,7 +28,6 @@ func createUnreleaseBox(box *gui.Node) {
})
group.NewButton("re-release"+release.versionS, func() {
me.Disable()
defer me.Enable()
if release.current.status.CheckDirty() {
log.Info("sorry, it's still dirty")
@ -44,28 +43,37 @@ func createUnreleaseBox(box *gui.Node) {
log.Info("\treset to devel", curName, release.versionS, release.reasonS)
release.current.status.RunCmd([]string{"git", "checkout", "devel"})
release.current.status.RunCmd([]string{"git", "branch", "-D", mName})
release.current.status.RunCmd([]string{"git", "branch", mName})
release.current.status.RunCmd([]string{"git", "checkout", mName})
release.current.status.RunCmd([]string{"git", "push", "--set-upstream", "--force", "origin", mName})
release.current.status.RunCmd([]string{"git", "tag", "--delete", "v" + release.versionS})
release.current.status.RunCmd([]string{"git", "push", "--delete", "origin", "v" + release.versionS})
release.current.status.RunCmd([]string{"git", "tag", "-m", release.reasonS, "v" + release.versionS})
release.current.status.RunCmd([]string{"git", "push", "origin", "v" + release.versionS})
// git tag --delete v0.3
// git push --delete origin v0.3
var all [][]string
all = append(all, []string{"git", "checkout", "devel"})
all = append(all, []string{"git", "branch", "-D", mName})
all = append(all, []string{"git", "branch", mName})
all = append(all, []string{"git", "checkout", mName})
all = append(all, []string{"git", "push", "--set-upstream", "--force", "origin", mName})
// git push --set-upstream --force origin guimaster
all = append(all, []string{"git", "tag", "--delete", "v" + release.versionS})
all = append(all, []string{"git", "push", "--delete", "origin", "v" + release.versionS})
all = append(all, []string{"git", "tag", "-m", release.reasonS, "v" + release.versionS})
all = append(all, []string{"git", "push", "origin", "v" + release.versionS})
// release.current.status.RunCmd([]string{"git", "branch", "--unset-upstream", mName})
/*
release.current.status.RunCmd([]string{"git", "add", "-f", "go.sum"})
release.current.status.RunCmd([]string{"git", "commit", "-m", release.reasonS})
release.current.status.RunCmd([]string{"git", "push"})
release.current.status.RunCmd([]string{"git", "tag", "-m", release.reasonS, "v" + release.versionS})
release.current.status.RunCmd([]string{"git", "push", "origin", "v" + release.versionS})
*/
if doAll(release.current, all) {
log.Info("EVERYTHING OK")
me.Enable()
} else {
log.Info("SOMETHING FAILED")
}
})
}
func doAll(r *repo, all [][]string) bool {
for _, cmd := range all {
log.Info("doAll() RUNNING: cmd =", cmd)
err, out := r.status.RunCmd(cmd)
log.Info("doAll() err =", err)
log.Info("doAll() out =", out)
if err != nil {
return false
}
}
return true
}