summaryrefslogtreecommitdiff
path: root/doRelease.go
diff options
context:
space:
mode:
Diffstat (limited to 'doRelease.go')
-rw-r--r--doRelease.go68
1 files changed, 24 insertions, 44 deletions
diff --git a/doRelease.go b/doRelease.go
index c51f9c2..ff6082c 100644
--- a/doRelease.go
+++ b/doRelease.go
@@ -6,6 +6,7 @@ import (
"path/filepath"
"strings"
+ "go.wit.com/lib/gui/repolist"
"go.wit.com/lib/gui/shell"
"go.wit.com/log"
)
@@ -23,36 +24,6 @@ func doRelease() bool {
log.Warn("version does not start with v.", release.version.String())
return false
}
- switch release.current.GoState() {
- case "PRIMATIVE":
- 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":
- log.Warn("attempting manual release", release.version.String())
- /*
- case "NOT READY":
- log.Warn("attempting to release. TODO: recheck go.sum here", release.version.String())
- log.Warn("Sleep 10")
- log.Sleep(10)
- case "UNRELEASED":
- log.Warn("attempting to release. TODO: dig deep on go.sum here", release.version.String())
- log.Warn("Sleep 10")
- log.Sleep(10)
- */
- default:
- log.Warn("what is this?", release.version.String(), release.current.Name())
- return false
- }
-
- if release.current.Status.ReadOnly() {
- log.Info("sorry, it's read-only")
- return true
- }
- if release.current.Status.CheckDirty() {
- log.Info("sorry, it's still dirty")
- return false
- }
curName := release.current.Status.GetCurrentBranchName()
mName := release.current.Status.GetMasterBranchName()
@@ -61,11 +32,15 @@ func doRelease() bool {
return false
}
+ if !checkValidGoSum(release.current) {
+ return false
+ }
+
log.Info("\ttag and push", curName, release.version.String(), me.releaseReasonS)
var all [][]string
all = append(all, []string{"git", "add", "-f", "go.mod"})
- if release.current.Status.CheckPrimativeGoMod() {
+ if release.current.Status.IsPrimitive() {
// don't add go.sum here. TODO: check for go.sum file and fail
} else {
all = append(all, []string{"git", "add", "-f", "go.sum"})
@@ -122,6 +97,23 @@ func doRelease() bool {
return true
}
+func checkValidGoSum(repo *repolist.Repo) bool {
+ ok, err := me.repos.View.CheckValidGoSum(repo)
+ if err != nil {
+ log.Info("go mod tidy not ok")
+ return false
+ }
+ if ok {
+ log.Info("repo has go.sum requirements that are clean")
+ // release.current.setGoSumStatus("CLEAN")
+ release.status.SetValue("GOOD")
+ release.notes.SetValue("CheckValidGoSum() does not seem to lie")
+ return true
+ }
+ release.notes.SetValue("CheckValidGoSum() failed")
+ return false
+}
+
// try to figure out if there is another package to update
func doReleaseFindNext() bool {
// scan for new repo
@@ -131,21 +123,9 @@ func doReleaseFindNext() bool {
log.Info("findNextDirty() could not find anything")
return false
}
- 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 {
- log.Info("repo has go.sum requirements that are clean")
- // release.current.setGoSumStatus("CLEAN")
- release.status.SetValue("GOOD")
- release.notes.SetValue("CheckGoSum() does not seem to lie")
+ if checkValidGoSum(release.current) {
return true
}
- release.notes.SetValue("CheckGoSum() failed")
return false
}