diff options
| -rw-r--r-- | argv.go | 23 | ||||
| -rw-r--r-- | doRelease.go | 64 | ||||
| -rw-r--r-- | main.go | 4 | ||||
| -rw-r--r-- | structs.go | 2 | ||||
| -rwxr-xr-x | unwind1.sh | 20 |
5 files changed, 62 insertions, 51 deletions
@@ -13,16 +13,17 @@ import ( */ type args struct { - Quick *QuickCmd `arg:"subcommand:quick" help:"only do repos with patches"` - DryRun bool `arg:"--dry-run,env:DRYRUN" help:"don't actually do the release"` - Minor bool `arg:"--minor" help:"increment minor verion numbers"` - Protobuf bool `arg:"--protobuf" help:"increment protobuf repos"` - Verbose bool `arg:"--verbose" help:"talk alot"` - Full bool `arg:"--full" help:"build every package"` - Reason string `arg:"--reason" help:"tag message"` - Force bool `arg:"--force" help:"try harder than normal"` - AutoRun bool `arg:"--auto-run" help:"automatically process everything"` - Port int `arg:"--port" default:"9419" help:"do fun stuff with curl"` + Quick *QuickCmd `arg:"subcommand:quick" help:"only do repos with patches"` + DryRun bool `arg:"--dry-run,env:DRYRUN" help:"don't actually do the release"` + Minor bool `arg:"--minor" help:"increment minor verion numbers"` + Protobuf bool `arg:"--protobuf" help:"increment protobuf repos"` + KeepGOMOD bool `arg:"--keep-gomod" help:"keep go.* and *.pb.go files in master"` + Verbose bool `arg:"--verbose" help:"talk alot"` + Full bool `arg:"--full" help:"build every package"` + Reason string `arg:"--reason" help:"tag message"` + Force bool `arg:"--force" help:"try harder than normal"` + AutoRun bool `arg:"--auto-run" help:"automatically process everything"` + Port int `arg:"--port" default:"9419" help:"do fun stuff with curl"` } func (args) Examples() string { @@ -67,7 +68,7 @@ func (args) Buildtime() (string, string) { func (a args) DoAutoComplete(pb *prep.Auto) { if pb.Cmd == "" { - pb.Autocomplete3([]string{"--bash", "quick", "--dry-run", "--full", "--reason", "--version", "--auto-run"}) + pb.Autocomplete3([]string{"--bash", "quick", "--dry-run", "--full", "--reason", "--version", "--auto-run", "--keep-gomod"}) } else { pb.SubCommand(pb.Goargs...) } diff --git a/doRelease.go b/doRelease.go index 6a4b941..774d508 100644 --- a/doRelease.go +++ b/doRelease.go @@ -188,25 +188,55 @@ func doRelease() error { log.Info("PUBLISH OK") // me.current.SetGoState("RELEASED") - // unwind and re-tag. Now that the go.mod and go.sum are published, revert - // to the development branch - if !me.current.RevertMasterToDevel() { - log.Info("Revert Failed") - findOk = false - return fmt.Errorf("REVERT FAILED %s", check.GetGoPath()) - } + if argv.KeepGOMOD { + log.Info("TRY THE CRAZY THING HERE") - // update tag - var retag [][]string - retag = append(retag, []string{"git", "tag", "--delete", me.release.version.String()}) - retag = append(retag, []string{"git", "push", "--delete", "origin", me.release.version.String()}) - retag = append(retag, []string{"git", "tag", "-m", me.releaseReasonS, me.release.version.String()}) - retag = append(retag, []string{"git", "push", "origin", me.release.version.String()}) + // delete tag + var retag [][]string + retag = append(retag, []string{"git", "tag", "--delete", me.release.version.String()}) + retag = append(retag, []string{"git", "push", "--delete", "origin", me.release.version.String()}) + if !me.current.RunAll(retag) { + log.Info("delete failed") + findOk = false + me.sh.BadExit("--keep-gomod testing", fmt.Errorf("DELETE TAG FAILED %s", check.GetGoPath())) + } - if !me.current.RunAll(retag) { - log.Info("retag failed") - findOk = false - return fmt.Errorf("RETAG FAILED %s", check.GetGoPath()) + // switch to devel branch ? + if check.CheckoutDevel() { + // ok? + } else { + // holy crap. die here + me.sh.BadExit("CheckoutDevel() failed", nil) + } + retag = append(retag, []string{"git", "tag", "-m", me.releaseReasonS, me.release.version.String()}) + retag = append(retag, []string{"git", "push", "origin", me.release.version.String()}) + + if !me.current.RunAll(retag) { + log.Info("retag failed") + me.sh.BadExit("--keep-gomod testing", fmt.Errorf("RETAG FAILED %s", check.GetGoPath())) + } + me.sh.BadExit("did --keep-gomod work?", nil) // MUST FAIL HERE + } else { + // unwind and re-tag. Now that the go.mod and go.sum are published, revert + // to the development branch + if !me.current.RevertMasterToDevel() { + log.Info("Revert Failed") + findOk = false + return fmt.Errorf("REVERT FAILED %s", check.GetGoPath()) + } + + // update tag + var retag [][]string + retag = append(retag, []string{"git", "tag", "--delete", me.release.version.String()}) + retag = append(retag, []string{"git", "push", "--delete", "origin", me.release.version.String()}) + retag = append(retag, []string{"git", "tag", "-m", me.releaseReasonS, me.release.version.String()}) + retag = append(retag, []string{"git", "push", "origin", me.release.version.String()}) + + if !me.current.RunAll(retag) { + log.Info("retag failed") + findOk = false + return fmt.Errorf("RETAG FAILED %s", check.GetGoPath()) + } } log.Info("EVERYTHING OK. RERELEASED", me.current.GetGoPath()) @@ -29,8 +29,8 @@ var argv args func main() { me = new(autoType) - me.myGui = prep.Gui() // prepares the GUI package for go-args - me.auto = prep.Bash3(&argv) // this line should be: prep.Bash(&argv) + me.myGui = prep.Gui() // prepares the GUI package for go-args + me.sh = prep.Bash3(&argv) // bash autocomplete me.forge = forgepb.Init() me.forge.ScanRepoDir() // looks for new dirs, checks existing repos for changes @@ -12,7 +12,7 @@ import ( var me *autoType type autoType struct { - auto *prep.Auto // more experiments for bash handling + sh *prep.Auto // more experiments for bash handling myGui *prep.GuiPrep // the gui handle itself releaseReasonS string // = "gocui dropdown select" release releaseStruct // notsure diff --git a/unwind1.sh b/unwind1.sh deleted file mode 100755 index 28e0304..0000000 --- a/unwind1.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -x - -if [ "$1" == "guimaster" ]; then - git checkout devel - git branch -D guimaster - git branch guimaster - git checkout guimaster - git push --set-upstream --force origin guimaster - exit -fi - -if [ "$1" == "master" ]; then - git checkout devel - git branch -D master - git branch master - git checkout master - git push --set-upstream --force origin master - exit -fi - |
