diff options
| author | Jeff Carr <[email protected]> | 2024-03-09 22:02:32 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-03-09 22:02:32 -0600 |
| commit | 0c8311467b35227c19b9d04302e4782887731d76 (patch) | |
| tree | 7647c87beedc1e1af9da9aac1d4e857e47ea7a54 /main.go | |
| parent | 0f48d99b437f7f7b96ec1b1d2f507ed15de98500 (diff) | |
add some cmdline argsv0.22.2
Diffstat (limited to 'main.go')
| -rw-r--r-- | main.go | 69 |
1 files changed, 69 insertions, 0 deletions
@@ -4,16 +4,22 @@ import ( "os" "path/filepath" + "github.com/alexflint/go-arg" "go.wit.com/gui" + "go.wit.com/lib/gui/repolist" "go.wit.com/lib/gui/shell" "go.wit.com/log" ) var VERSION string +var myargs args func main() { me = new(autoType) + // parse the command line + arg.MustParse(&myargs) + // save the ENV var here me.releaseReasonS = os.Getenv("GUIRELEASE_REASON") @@ -87,6 +93,9 @@ func main() { // TODO: should not really be necessary directly after init() me.repos.View.ScanRepositories() + // the repo from the command line + var myrepo *repolist.RepoRow + // find myself. the guireleaser directory is used as a working scratchpad // for running go commands that can mess up the go.* files for _, repo := range me.repos.View.AllRepos() { @@ -95,6 +104,66 @@ func main() { me.release.guireleaser = repo } } + if repo.GoPath() == myargs.Repo { + myrepo = repo + } + } + + if myargs.Repo != "" { + me.mainWindow.Hide() + if myrepo == nil { + log.Info("could not find", myargs.Repo) + os.Exit(0) + } + log.Info("only going to do repo:", myrepo.GoPath()) + tmp := myargs.Reason + if tmp == "" { + tmp = os.Getenv("GUIRELEASE_REASON") + } + if tmp == "" { + tmp = "made by guireleaser" + } + + // increment all the versions + for _, repo := range me.repos.View.AllRepos() { + if whitelist(repo.GoPath()) { + continue + } + if repo.ReadOnly() { + continue + } + lasttag := repo.Status.LastTag() + if repo.Status.GetCurrentVersion() == lasttag { + log.Info("skipping unchanged repo", repo.Status.GoPath()) + repo.Status.SetTargetVersion(lasttag) + continue + } + repo.Status.IncrementRevisionVersion("go-clone") + } + // rescan all the repos + me.repos.View.ScanRepositories() + + + myrepo.Status.MakeRedomod() + myrepo.Status.IncrementRevisionVersion(tmp) + _, err := me.repos.View.CheckValidGoSum(myrepo) + if err != nil { + log.Info("go mod tidy not ok", err) + return + } + if !checkValidGoSum(myrepo) { + log.Info("go.sum checks failed") + os.Exit(0) + } + setCurrentRepo(myrepo, "should be good to release", "pretty sure") + log.Info("DO THE RELEASE HERE") + log.Info("going to release", myrepo.GoPath(), "as version", myrepo.Status.GetTargetVersion()) + if myargs.DryRun { + log.Info("--dry-run == true") + } else { + doRelease() + } + os.Exit(0) } if me.release.guireleaser == nil { |
