skip publish for private repos

This commit is contained in:
Jeff Carr 2024-02-23 11:31:07 -06:00
parent 1f5b5d4688
commit 6ad559dbbc
2 changed files with 22 additions and 7 deletions

View File

@ -147,13 +147,22 @@ func doPublishVersion() bool {
log.Info("go.sum must exist here") log.Info("go.sum must exist here")
me.release.guireleaser.Status.MakeRedomod() me.release.guireleaser.Status.MakeRedomod()
} }
os.Unsetenv("GO111MODULE") var err error
log.Info("TRYING TO SELF UPDATE HERE. cmd =", cmd) var out string
err, out := me.release.guireleaser.Status.RunCmd(cmd) if me.current.Status.IsPrivate() {
if gopath == "go.wit.com/apps/guireleaser" { // do not self update private repos
// ignore errors on updating myself
log.Info("IGNORE SELF UPDATE ERROR. cmd =", cmd)
err = nil err = nil
out = "This is a private repo and can not be self checked"
} else {
// publish go.mod & go.sum for use with go
os.Unsetenv("GO111MODULE")
log.Info("TRYING TO SELF UPDATE HERE. cmd =", cmd)
err, out = me.release.guireleaser.Status.RunCmd(cmd)
if gopath == "go.wit.com/apps/guireleaser" {
// ignore errors on updating myself
log.Info("IGNORE SELF UPDATE ERROR. cmd =", cmd)
err = nil
}
} }
if err == nil { if err == nil {
log.Info("SELF UPDATE OK. out =", out) log.Info("SELF UPDATE OK. out =", out)

View File

@ -30,7 +30,13 @@ func setTargetVersion() {
if repo.GoPath() == "go.wit.com/widget" { if repo.GoPath() == "go.wit.com/widget" {
repo.Status.SetTargetVersion("v" + widgetVersion) repo.Status.SetTargetVersion("v" + widgetVersion)
} else { } else {
repo.Status.SetTargetVersion("v" + releaseVersion) prefix := "v" + releaseVersion
lasttag := repo.Status.LastTag()
if strings.HasPrefix(lasttag, prefix) {
repo.Status.SetTargetVersion(lasttag)
} else {
repo.Status.SetTargetVersion(prefix)
}
} }
if strings.HasPrefix(repo.GoPath(), "go.wit.com/dev/") { if strings.HasPrefix(repo.GoPath(), "go.wit.com/dev/") {
lasttag := repo.Status.GetLastTagVersion() lasttag := repo.Status.GetLastTagVersion()