add --release builds

This commit is contained in:
Jeff Carr 2024-02-20 23:13:26 -06:00
parent c9f149bcb2
commit 38b1ecab60
6 changed files with 83 additions and 25 deletions

View File

@ -7,9 +7,15 @@ no-gui: build
./go-deb --no-gui --repo go.wit.com/apps/autotypist
build:
-mkdir resources
-cp ~/go/src/go.wit.com/toolkits/*.so resources/
GO111MODULE="off" go build -v
install:
-mkdir resources
-cp ~/go/src/go.wit.com/toolkits/*.so resources/
GO111MODULE="off" go install -v
goimports:
goimports -w *.go
@ -40,3 +46,27 @@ debian:
mirrors:
-wit mirrors
build-all:
go-deb --no-gui --repo go.wit.com/apps/autotypist
go-deb --no-gui --repo go.wit.com/apps/control-panel-digitalocean
go-deb --no-gui --repo go.wit.com/apps/control-panel-vpn
go-deb --no-gui --repo go.wit.com/apps/go-gui-toolkits
go-deb --no-gui --repo go.wit.com/apps/guireleaser
go-deb --no-gui --repo go.wit.com/apps/control-panel-cloudflare
go-deb --no-gui --repo go.wit.com/apps/control-panel-dns
go-deb --no-gui --repo go.wit.com/apps/go-deb
go-deb --no-gui --repo go.wit.com/apps/go.wit.com
go-deb --no-gui --repo go.wit.com/apps/helloworld
build-releases:
go-deb --release --no-gui --repo go.wit.com/apps/autotypist
go-deb --release --no-gui --repo go.wit.com/apps/control-panel-digitalocean
go-deb --release --no-gui --repo go.wit.com/apps/control-panel-vpn
go-deb --release --no-gui --repo go.wit.com/apps/go-gui-toolkits
go-deb --release --no-gui --repo go.wit.com/apps/guireleaser
go-deb --release --no-gui --repo go.wit.com/apps/control-panel-cloudflare
go-deb --release --no-gui --repo go.wit.com/apps/control-panel-dns
go-deb --release --no-gui --repo go.wit.com/apps/go-deb
go-deb --release --no-gui --repo go.wit.com/apps/go.wit.com
go-deb --release --no-gui --repo go.wit.com/apps/helloworld

View File

@ -25,12 +25,12 @@ func (c *controlBox) addRepo(path string) {
return
}
if repostatus.VerifyLocalGoRepo(path) {
log.Verbose("path actually exists", path)
} else {
log.Warn("repostatus.VerifyLocalGoRepo() failed for for", path)
return
}
// if repostatus.VerifyLocalGoRepo(path) {
// log.Verbose("path actually exists", path)
// } else {
// log.Warn("repostatus.VerifyLocalGoRepo() failed for for", path)
// return
// }
c.pathL = gadgets.NewOneLiner(c.grid, "path")
c.pathL.SetText(path)
@ -54,10 +54,15 @@ func (c *controlBox) addRepo(path string) {
c.tagDate = gadgets.NewOneLiner(c.grid, "git tag Date")
c.grid.NextRow()
c.status = repostatus.NewRepoStatusWindow(path)
c.status.SetMainWorkingName("master")
c.status.SetDevelWorkingName("devel")
c.status.SetUserWorkingName("jcarr")
err, repo := repostatus.NewRepoStatusWindow(path)
if err != nil {
log.Info("path did not work", path, err)
return
}
c.status = repo
// c.status.SetMainWorkingName("master")
// c.status.SetDevelWorkingName("devel")
// c.status.SetUserWorkingName("jcarr")
c.status.Update()
cbname := c.status.GetCurrentBranchName()
@ -71,17 +76,23 @@ func (c *controlBox) addRepo(path string) {
c.dirtyL.SetText("false")
}
lasttag := c.status.GetLastTagVersion()
if args.Release {
debversion = lasttag
debversion = strings.TrimPrefix(debversion, "v")
c.dirtyL.SetText("false")
}
c.Version.SetText(debversion)
lasttag := c.status.GetLastTagVersion()
c.lastTag.SetText(lasttag)
c.currentL.SetText(cbname + " " + cbversion)
tagDate := c.getDateStamp(lasttag)
c.tagDate.SetText(tagDate)
if c.status.Changed() {
log.Warn("should scan here")
if s, ok := c.status.Changed(); ok {
log.Warn("should scan here", s)
}
return

View File

@ -13,9 +13,10 @@ import (
)
var args struct {
NoGui bool `arg:"--no-gui" help:"don't open the gui, just make the .deb"`
Repo string `arg:"--repo" help:"go get path to the repo"`
PkgDir string `arg:"--pkg-dir" help:"set default directory (~/incoming/)"`
NoGui bool `arg:"--no-gui" help:"don't open the gui, just make the .deb"`
Repo string `arg:"--repo" help:"go get path to the repo"`
PkgDir string `arg:"--pkg-dir" help:"set default directory (~/incoming/)"`
Release bool `arg:"--release" help:"build a release from the last git tag"`
}
func init() {

View File

@ -28,7 +28,7 @@ type controlBox struct {
dirtyL *gadgets.OneLiner
currentL *gadgets.OneLiner
buildDate *gadgets.OneLiner
tagDate *gadgets.OneLiner
tagDate *gadgets.OneLiner
status *repostatus.RepoStatus
}

View File

@ -36,6 +36,7 @@ func main() {
// scan the repo
cBox.addRepo(args.Repo)
// look for a 'config' file in the repo
if cBox.readControlFile() == nil {
log.Warn("scan worked")
@ -50,6 +51,7 @@ func main() {
log.Info("build worked")
} else {
log.Warn("build failed")
os.Exit(-1)
}
os.Exit(0)
}

View File

@ -60,14 +60,27 @@ func makebasicWindow() *gadgets.BasicWindow {
func (c *controlBox) buildPackage() bool {
// TODO: if dirty, set GO111MODULE
// also, if last tag != version
if c.status.CheckDirty() {
os.Setenv("GO111MODULE", "off")
}
if shell.Run([]string{"go", "build", "-v", "-x"}) {
log.Warn("build worked")
if args.Release {
os.Unsetenv("GO111MODULE")
path := c.pathL.String() + "@latest"
cmd := []string{"go", "install", "-v", "-x", path}
if shell.Run(cmd) {
log.Warn("build worked")
} else {
log.Warn("build failed")
return false
}
} else {
log.Warn("build failed")
return false
if c.status.CheckDirty() {
os.Setenv("GO111MODULE", "off")
}
if shell.Run([]string{"go", "build", "-v", "-x"}) {
log.Warn("build worked")
} else {
log.Warn("build failed")
return false
}
}
filename := c.Package.String()
@ -212,7 +225,8 @@ func (c *controlBox) computeControlValues() bool {
// TODO: get this from gitea (or gitlab or github, etc)
// or from the README.md ?
if c.Description.String() == "" {
c.Description.SetText("missing control file")
path := c.pathL.String()
c.Description.SetText("GO binary of " + path)
}
return true
}