attempt to AutogenSave() files

This commit is contained in:
Jeff Carr 2024-12-13 16:19:12 -06:00
parent 02bce38b78
commit ffade519ff
1 changed files with 21 additions and 1 deletions

View File

@ -58,12 +58,20 @@ func doRelease() bool {
log.Info("\ttag and push", curName, me.release.version.String(), me.releaseReasonS)
if err := check.ValidGoSum(); err != nil {
log.Info("ValidGoSum() error", check.GoPath, err)
os.Exit(-1)
}
var all [][]string
var autogen []string
all = append(all, []string{"git", "add", "-f", "go.mod"})
if ok, _ := check.IsPrimitive(); ok {
autogen = append(autogen, "go.mod")
if check.GoPrimitive {
// don't add go.sum here. TODO: check for go.sum file and fail
} else {
all = append(all, []string{"git", "add", "-f", "go.sum"})
autogen = append(autogen, "go.sum")
}
if ok, compiled, err := me.current.IsProtobuf(); ok {
log.Info("\tIsProtobuf() == true")
@ -77,6 +85,7 @@ func doRelease() bool {
for _, s := range compiled {
log.Info("\tcompiled file found:", s)
all = append(all, []string{"git", "add", "-f", s})
autogen = append(autogen, s)
}
} else {
log.Info("\tIsProtobuf() == false")
@ -86,6 +95,13 @@ func doRelease() bool {
all = append(all, []string{"git", "tag", "-m", me.releaseReasonS, me.release.version.String()})
all = append(all, []string{"git", "push", "origin", me.release.version.String()})
// save the autogenerated files in git metadata (aka: notes)
cname := check.GetCurrentBranchName()
if err := check.AutogenSave(autogen, cname, true); err != nil {
log.Info("AutogenSave() error", err)
os.Exit(-1)
}
if !me.current.Status.DoAll(all) {
log.Info("failed to make new release", me.release.version.String())
findOk = false
@ -137,6 +153,10 @@ func doRelease() bool {
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 err := check.AutogenRestore(cname); err != nil {
log.Info("AutogenRestore() failed", err)
}
if !me.current.Status.DoAll(retag) {
log.Info("retag failed")
findOk = false