diff options
Diffstat (limited to 'doRelease.go')
| -rw-r--r-- | doRelease.go | 76 |
1 files changed, 40 insertions, 36 deletions
diff --git a/doRelease.go b/doRelease.go index ee4c4b4..9c8f910 100644 --- a/doRelease.go +++ b/doRelease.go @@ -12,23 +12,24 @@ import ( "go.wit.com/log" ) -func doRelease() bool { +func doRelease() error { + check := me.current log.Info("doRelease() on", me.current.GetGoPath()) if !findOk { log.Info("doRelease() immediately end something went wrong last time. findOk == false") - return false + return fmt.Errorf("findOK = false %s", check.GetGoPath()) } // double check release version logic if me.release.releaseVersionB.String() != "release version "+me.release.version.String() { log.Warn("something went wrong with the release.version:", me.release.version.String()) - return false + return fmt.Errorf("GUI lied %s", check.GetGoPath()) } if strings.HasPrefix(me.release.version.String(), "v") { log.Warn("everything is ok. version starts with v.", me.release.version.String()) } else { log.Warn("version does not start with v.", me.release.version.String()) - return false + return fmt.Errorf("release does not start with a v %s", check.GetGoPath()) } if shell.Exists("go.mod") { @@ -36,22 +37,16 @@ func doRelease() bool { } else { pwd, _ := os.Getwd() log.Info("go.mod missing in working dir", pwd) - return false + return fmt.Errorf("go.mod missing %s", check.GetGoPath()) } curName := me.current.GetCurrentBranchName() mName := me.current.GetMasterBranchName() if curName != mName { log.Info("\trepo is not working from main branch", curName, "!=", mName) - return false + return fmt.Errorf("not on main branch %s", check.GetGoPath()) } - // check := me.forge.FindByGoPath(me.current.GetGoPath()) - check := me.current - if check == nil { - log.Info("boo, you didn't git clone", me.current.GetGoPath()) - return false - } if alreadyDone(check) { // means it was already published // protects against logic errors that might result @@ -60,14 +55,13 @@ func doRelease() bool { log.Info("doRelease() WARNING. should have never gotten here. return true. already done", check.GetGoPath()) log.Info("doRelease() WARNING. should have never gotten here. return true. already done", check.GetGoPath()) check.Reload() - log.Sleep(1) - return true + return fmt.Errorf("already released %s", check.GetGoPath()) } me.done = append(me.done, me.current.GetGoPath()) if err := me.forge.FinalGoDepsCheckOk(check, true); err != nil { msg := fmt.Sprint("the go.mod file is wrong. fix it here?", check.GetGoPath()) badExit(errors.New(msg)) - return false + return fmt.Errorf("FinalGoDeps %s err %v", check.GetGoPath(), err) } if check.GetGoPath() == me.startRepo.GetGoPath() { log.Info("CAN NOT SELF UPDATE.", check.GetGoPath(), "is the same as os.Getwd()") @@ -136,7 +130,7 @@ func doRelease() bool { if !me.current.RunAll(all) { log.Info("failed to make new release", me.release.version.String()) findOk = false - return false + return fmt.Errorf("setting findOK = false %s", check.GetGoPath()) } log.Info("RELEASE OK") @@ -147,7 +141,7 @@ func doRelease() bool { if !doPublishVersion() { log.Info("PUBLISH FAILED") findOk = false - return false + return fmt.Errorf("PUBLISH FAILED %s", check.GetGoPath()) } } @@ -159,7 +153,7 @@ func doRelease() bool { if !me.current.RevertMasterToDevel() { log.Info("Revert Failed") findOk = false - return false + return fmt.Errorf("REVERT FAILED %s", check.GetGoPath()) } // update tag @@ -179,7 +173,7 @@ func doRelease() bool { if !me.current.RunAll(retag) { log.Info("retag failed") findOk = false - return false + return fmt.Errorf("RETAG FAILED %s", check.GetGoPath()) } log.Info("EVERYTHING OK. RERELEASED", me.current.GetGoPath()) @@ -191,31 +185,40 @@ func doRelease() bool { badExit(errors.New(msg)) } + me.forge.SetConfigSave(true) + me.forge.ConfigSave() + log.Info("sleep 2") + time.Sleep(2 * time.Second) printDone() - log.Info("sleep 2, then Reload()", check.GetGoPath()) - time.Sleep(2 * time.Second) // notsure - check.Reload() - // run this each time something gets published successfully - rePrepareRelease() + /* + // run this each time something gets published successfully - findNext() - - // attempt to find another repo to release - if !doReleaseFindNext() { - log.Info("doReleaseFindNext() could not find a new", findCounter) - log.Info("THIS PROBABLY MEANS THAT ACTUALLY WE ARE TOTALLY DONE?", findCounter) - count := me.forge.PrintReleaseReport(me.found) - log.Info("count =", count) - os.Setenv("FindNextDone", "true") + // attempt to find another repo to release + if !doReleaseFindNext() { + log.Info("doReleaseFindNext() could not find a new", findCounter) + log.Info("THIS PROBABLY MEANS THAT ACTUALLY WE ARE TOTALLY DONE?", findCounter) + count := me.forge.PrintReleaseReport(me.found) + log.Info("count =", count) + os.Setenv("FindNextDone", "true") + printDone() + return false + } printDone() - return false + */ + rePrepareRelease() + findNext() + if me.current == nil { + log.Info("NOT GOOD TO RUN ANOTHER DAY") + log.Info("took out all the loop code") + setCurrentRepo(nil, "loop by hand motherfucker", "fucknuts") + return fmt.Errorf("findNext returned next repo == nil") } log.Info("GOOD TO RUN ANOTHER DAY ON:", me.current.GetGoPath()) - printDone() - return true + return nil } +/* // try to figure out if there is another package to update // returns true if it finds something func doReleaseFindNext() bool { @@ -246,6 +249,7 @@ func doReleaseFindNext() bool { } return false } +*/ // this pulls the new tag from the golang package repository // to insert the new version |
