guireleaser/doSingleRepo.go

74 lines
1.8 KiB
Go

package main
import (
"os"
"go.wit.com/lib/gui/repolist"
"go.wit.com/log"
)
func doSingleRepo(myRepoName string) {
// 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() {
myrepo = me.repos.View.FindRepoByName(myRepoName)
me.mainWindow.Disable()
defer me.mainWindow.Enable()
if myrepo == nil {
log.Info("could not find", myargs.Repo)
}
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 {
log.Info("--dry-run == true")
// doRelease()
}
}