diff options
Diffstat (limited to 'doRelease.go')
| -rw-r--r-- | doRelease.go | 41 |
1 files changed, 14 insertions, 27 deletions
diff --git a/doRelease.go b/doRelease.go index 68af367..6713259 100644 --- a/doRelease.go +++ b/doRelease.go @@ -3,7 +3,6 @@ package main import ( "os" - "path/filepath" "strings" "time" @@ -227,18 +226,12 @@ func doPublishVersion() bool { docmd := []string{"go", "get", "-v", gopath + "@" + me.release.version.String()} log.Info("SHOULD RUN cmd HERE:", docmd) - testf := filepath.Join(me.forge.GetGoSrc(), "go.wit.com/apps/guireleaser", "go.sum") - if !shell.Exists(testf) { - pb := me.forge.Repos.FindByGoPath("go.wit.com/apps/guireleaser") - if pb != nil { - if err := pb.RunStrict([]string{"go-mod-clean"}); err != nil { - log.Info("go-mod-clean failed", err) - } - } - if !shell.Exists(testf) { - log.Info("go.sum missing", testf) - panic("redo go.sum") - } + if !me.startRepo.Exists("go.mod") { + log.Info("go.sum missing in", me.startRepo.GoPath) + log.Info("pick a different repo here") + log.Info("todo: error out earlier knowing this will upgrade") + log.Info("versions", me.startRepo.GetTargetVersion(), me.startRepo.GetMasterVersion()) + panic("redo go.sum") } if me.current.Status.IsPrivate() { // do not self update private repos @@ -248,23 +241,17 @@ func doPublishVersion() bool { // try to pull from google var result cmd.Status - if gopath == "go.wit.com/apps/guireleaser" { + if gopath == me.startRepo.GoPath { log.Info("CAN NOT SELF UPDATE. cmd =", docmd) log.Info("go get must be run from somewhere else other than guireleaser") log.Info("chdir to autotypist if it exists") - if shell.Exists("/home/jcarr/go/src/go.wit.com/apps/autotypist") { - os.Chdir("/home/jcarr/go/src/go.wit.com/apps/autotypist") - } else { - log.Info("need to chdir somewhere with go.sum & go.mod") - return false - } - // result = shell.PathRun("/home/jcarr/go/src/go.wit.com/apps/autotypist", docmd) - } else { - // publish go.mod & go.sum for use with go - os.Unsetenv("GO111MODULE") - log.Info("TRYING TO SELF UPDATE HERE. cmd =", docmd) - result = me.release.guireleaser.Status.Run(docmd) + os.Exit(-1) } + // publish go.mod & go.sum for use with go + os.Unsetenv("GO111MODULE") + log.Info("TRYING TO SELF UPDATE HERE. cmd =", docmd) + result = me.startRepo.Run(docmd) + if result.Error != nil { log.Info("SELF UPDATE FAILED. error =", result.Error) log.Info("SELF UPDATE FAILED. exit =", result.Exit) @@ -279,7 +266,7 @@ func doPublishVersion() bool { log.Info("SELF UPDATE FAILED") return false } - log.Info("SELF UPDATE OK. out =", result.Stdout) + log.Info("SELF UPDATE OK. out =", strings.Join(result.Stdout, "\n")) log.Info("SELF UPDATE WORKED") return true } |
