diff options
| author | Jeff Carr <[email protected]> | 2024-02-18 15:09:04 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-02-18 15:09:04 -0600 |
| commit | 08c7765cc70bae20479ad0aa1897b6a4cfc3613a (patch) | |
| tree | dacc65539b521cd3fc285579712bd2ef7bd8a486 /doRelease.go | |
| parent | bbc78159fe11c78ae33cc8026887f62888003630 (diff) | |
guireleaser builds again
Diffstat (limited to 'doRelease.go')
| -rw-r--r-- | doRelease.go | 52 |
1 files changed, 23 insertions, 29 deletions
diff --git a/doRelease.go b/doRelease.go index 2d2b9d1..64679ec 100644 --- a/doRelease.go +++ b/doRelease.go @@ -11,7 +11,7 @@ import ( ) func doRelease() bool { - log.Info("doRelease() on", release.current.String()) + log.Info("doRelease() on", release.current.Name()) // double check release version logic if release.releaseVersionB.String() != "release version "+release.version.String() { log.Warn("something went wrong with the release.version:", release.version.String()) @@ -23,9 +23,9 @@ func doRelease() bool { log.Warn("version does not start with v.", release.version.String()) return false } - switch release.status.String() { + switch release.current.Status.GetGoSumStatus() { case "PRIMATIVE": - log.Warn("can do PRIMATIVE", release.version.String()) + log.Warn("can do PRIMATIVE", release.current.Name()) case "GOOD": log.Warn("GOOD. lots of go.sum checks passed", release.version.String()) case "manually chosen": @@ -41,21 +41,21 @@ func doRelease() bool { log.Sleep(10) */ default: - log.Warn("what is this?", release.version.String(), release.status.String()) + log.Warn("what is this?", release.version.String(), release.current.Name()) return false } - if release.current.status.ReadOnly() { + if release.current.Status.ReadOnly() { log.Info("sorry, it's read-only") return true } - if release.current.status.CheckDirty() { + if release.current.Status.CheckDirty() { log.Info("sorry, it's still dirty") return false } - curName := release.current.status.GetCurrentBranchName() - mName := release.current.status.GetMasterBranchName() + curName := release.current.Status.GetCurrentBranchName() + mName := release.current.Status.GetMasterBranchName() if curName != mName { log.Info("\trepo is not working from main branch", curName, "!=", mName) return false @@ -65,7 +65,7 @@ func doRelease() bool { var all [][]string all = append(all, []string{"git", "add", "-f", "go.mod"}) - if release.current.status.CheckPrimativeGoMod() { + if release.current.Status.CheckPrimativeGoMod() { // don't add go.sum here. TODO: check for go.sum file and fail } else { all = append(all, []string{"git", "add", "-f", "go.sum"}) @@ -75,7 +75,7 @@ func doRelease() bool { all = append(all, []string{"git", "tag", "-m", me.releaseReasonS, release.version.String()}) all = append(all, []string{"git", "push", "origin", release.version.String()}) - if !release.current.status.DoAll(all) { + if !release.current.Status.DoAll(all) { log.Info("failed to make new release", release.version.String()) return false } @@ -88,11 +88,11 @@ func doRelease() bool { } log.Info("PUBLISH OK") - release.current.setGoSumStatus("RELEASED") + release.current.Status.SetGoSumStatus("RELEASED") // unwind and re-tag. Now that the go.mod and go.sum are published, revert // to the development branch - if !release.current.status.RevertMasterToDevel() { + if !release.current.Status.RevertMasterToDevel() { log.Info("Revert Failed") return false } @@ -104,27 +104,21 @@ func doRelease() bool { retag = append(retag, []string{"git", "tag", "-m", me.releaseReasonS, release.version.String()}) retag = append(retag, []string{"git", "push", "origin", release.version.String()}) - if !release.current.status.DoAll(retag) { + if !release.current.Status.DoAll(retag) { log.Info("retag failed") return false } - log.Info("EVERYTHING OK. RERELEASED", release.current.String()) + log.Info("EVERYTHING OK. RERELEASED", release.current.Name()) - // update the package versions used for checking go.sum validity - release.current.status.UpdateNew() - cbname := release.current.status.GetCurrentBranchName() - cbversion := release.current.status.GetCurrentBranchVersion() - lasttag := release.current.status.GetLastTagVersion() // update the values in the GUI - release.current.lastTag.SetLabel(lasttag) - release.current.vLabel.SetLabel(cbname + " " + cbversion) + release.current.Status.UpdateNew() // attempt to find another repo to release if !doReleaseFindNext() { log.Info("doReleaseFindNext() could not find a new") return false } - log.Info("GOOD TO RUN ANOTHER DAY ON:", release.current.String()) + log.Info("GOOD TO RUN ANOTHER DAY ON:", release.current.Name()) return true } @@ -137,14 +131,14 @@ func doReleaseFindNext() bool { log.Info("findNextDirty() could not find anything") return false } - release.current.status.CheckSafeGoSumRemake() - if release.current.status.MakeRedomod() { + release.current.Status.CheckSafeGoSumRemake() + if release.current.Status.MakeRedomod() { log.Info("Redo mod ok") } else { log.Info("go mod tidy not ok") return false } - if ok, _ := release.current.status.CheckGoSum(); ok { + if ok, _ := release.current.Status.CheckGoSum(); ok { log.Info("repo has go.sum requirements that are clean") // release.current.setGoSumStatus("CLEAN") release.status.SetValue("GOOD") @@ -158,7 +152,7 @@ func doReleaseFindNext() bool { // this pulls the new tag from the golang package repository // to insert the new version func doPublishVersion() bool { - gopath := release.current.String() + gopath := release.current.GoPath() cmd := []string{"go", "get", "-v", gopath + "@" + release.version.String()} log.Info("SHOULD RUN cmd HERE:", cmd) @@ -171,11 +165,11 @@ func doPublishVersion() bool { gosum := filepath.Join(homeDir, "go/src/go.wit.com/apps/guireleaser/go.sum") if !shell.Exists(gosum) { log.Info("go.sum must exist here") - release.guireleaser.status.MakeRedomod() + release.guireleaser.Status.MakeRedomod() } os.Unsetenv("GO111MODULE") log.Info("TRYING TO SELF UPDATE HERE. cmd =", cmd) - err, out := release.guireleaser.status.RunCmd(cmd) + err, out := release.guireleaser.Status.RunCmd(cmd) if gopath == "go.wit.com/apps/guireleaser" { // ignore errors on updating myself log.Info("IGNORE SELF UPDATE ERROR. cmd =", cmd) @@ -184,7 +178,7 @@ func doPublishVersion() bool { if err == nil { log.Info("SELF UPDATE OK. out =", out) log.Info("SELF UPDATE WORKED") - release.current.setGoSumStatus("RELEASED") + release.current.Status.SetGoSumStatus("RELEASED") return true } return false |
