diff --git a/argv.go b/argv.go index b872f80..7d57324 100644 --- a/argv.go +++ b/argv.go @@ -13,6 +13,7 @@ type args struct { DryRun bool `arg:"--dry-run,env:DRYRUN" help:"don't actually do the release"` Fix bool `arg:"--fix" help:"run fixGoMod() on startup"` Minor bool `arg:"--minor" help:"increment minor verion numbers"` + Protobuf bool `arg:"--protobuf" help:"increment protobuf repos"` Reason string `arg:"--reason" help:"tag message"` DumpVersions bool `arg:"--dump-versions" help:"dump the versions file for go.wit.com"` Port int `arg:"--port" default:"9419" help:"do fun stuff with curl"` diff --git a/findNext.go b/findNext.go index 76d3c3a..a6c0ea6 100644 --- a/findNext.go +++ b/findNext.go @@ -2,6 +2,8 @@ package main import ( + "strings" + "go.wit.com/log" "go.wit.com/lib/gui/repolist" @@ -101,15 +103,23 @@ func runGoClean(check *gitpb.Repo) bool { // check if the package dependancies changed, if so, re-publish check.GoDeps = nil - cmd := []string{"go-mod-clean", "--strict", "--force"} + cmd := []string{"go-mod-clean", "--strict"} log.Info("Running", cmd, "in", check.GoPath) - result := check.RunRealtime(cmd) + result := check.Run(cmd) if result.Error != nil { log.Info(cmd, "failed with", result.Error, check.GoPath) + log.Info("STDOUT") + log.Info(strings.Join(result.Stdout, "\n")) + log.Info("STDERR") + log.Info(strings.Join(result.Stderr, "\n")) return false } if result.Exit != 0 { log.Info(cmd, "failed with", result.Exit, check.GoPath) + log.Info("STDOUT") + log.Info(strings.Join(result.Stdout, "\n")) + log.Info("STDERR") + log.Info(strings.Join(result.Stderr, "\n")) return false } if ok, err := check.ParseGoSum(); !ok { diff --git a/main.go b/main.go index 4c8ea02..c30b73a 100644 --- a/main.go +++ b/main.go @@ -118,7 +118,7 @@ func main() { me.startRepo = me.forge.Repos.FindByGoPath(basedir) // todo: add this to forgepb - // me.startRepo = me.forge.FindWorkingDirRepo() + me.startRepo = me.forge.FindWorkingDirRepo() if me.startRepo == nil { msg := fmt.Sprint("Can not run if pwd is not a repo", basedir) diff --git a/prepareRelease.go b/prepareRelease.go index 4c14bf5..060308d 100644 --- a/prepareRelease.go +++ b/prepareRelease.go @@ -1,6 +1,7 @@ package main import ( + "go.wit.com/lib/protobuf/gitpb" "go.wit.com/log" ) @@ -41,16 +42,13 @@ func makePrepareRelease() { master := check.GetMasterVersion() lastTag := check.GetLastTag() if master != lastTag { - if argv.Minor { - // if v1.2.3 change to v.1.3.0 - check.IncrementTargetMinor() - } else { - // if v1.2.3 change to v.1.2.4 - check.IncrementTargetRevision() - } - if !runGoClean(check) { - log.Info("go-mod-clean FAILED. THIS IS BAD.", check.GoPath) - } + forceReleaseVersion(check) + continue + } + + if argv.Protobuf && check.RepoType() == "protobuf" { + // if --protobuf, this will force upgrade each one + forceReleaseVersion(check) continue } @@ -63,21 +61,7 @@ func makePrepareRelease() { continue } log.Printf("dependancy checks indicate a new release is needed for %s\n", check.GetGoPath()) - if argv.Minor { - // if v1.2.3 change to v.1.3.0 - check.IncrementTargetMinor() - } else { - // if v1.2.3 change to v.1.2.4 - check.IncrementTargetRevision() - } - // run go-mod-clean in each repo that needs to be updated - if master == lastTag { - // 'git notes' has something in it. clear it out - check.Run([]string{"git", "notes", "remove"}) - } - if !runGoClean(check) { - log.Info("go-mod-clean probably failed here. that's ok", check.GoPath) - } + forceReleaseVersion(check) } } @@ -94,3 +78,19 @@ func makePrepareRelease() { } } } + +func forceReleaseVersion(repo *gitpb.Repo) { + if argv.Minor { + // if v1.2.3 change to v.1.3.0 + repo.IncrementTargetMinor() + } else { + // if v1.2.3 change to v.1.2.4 + repo.IncrementTargetRevision() + } + // empty git notes + repo.Run([]string{"git", "notes", "remove"}) + + if !runGoClean(repo) { + log.Info("go-mod-clean probably failed here. that's ok", repo.GoPath) + } +}