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 ./go-deb --no-gui --repo go.wit.com/apps/autotypist
build: build:
-mkdir resources
-cp ~/go/src/go.wit.com/toolkits/*.so resources/ -cp ~/go/src/go.wit.com/toolkits/*.so resources/
GO111MODULE="off" go build -v GO111MODULE="off" go build -v
install:
-mkdir resources
-cp ~/go/src/go.wit.com/toolkits/*.so resources/
GO111MODULE="off" go install -v
goimports: goimports:
goimports -w *.go goimports -w *.go
@ -40,3 +46,27 @@ debian:
mirrors: mirrors:
-wit 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 return
} }
if repostatus.VerifyLocalGoRepo(path) { // if repostatus.VerifyLocalGoRepo(path) {
log.Verbose("path actually exists", path) // log.Verbose("path actually exists", path)
} else { // } else {
log.Warn("repostatus.VerifyLocalGoRepo() failed for for", path) // log.Warn("repostatus.VerifyLocalGoRepo() failed for for", path)
return // return
} // }
c.pathL = gadgets.NewOneLiner(c.grid, "path") c.pathL = gadgets.NewOneLiner(c.grid, "path")
c.pathL.SetText(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.tagDate = gadgets.NewOneLiner(c.grid, "git tag Date")
c.grid.NextRow() c.grid.NextRow()
c.status = repostatus.NewRepoStatusWindow(path) err, repo := repostatus.NewRepoStatusWindow(path)
c.status.SetMainWorkingName("master") if err != nil {
c.status.SetDevelWorkingName("devel") log.Info("path did not work", path, err)
c.status.SetUserWorkingName("jcarr") return
}
c.status = repo
// c.status.SetMainWorkingName("master")
// c.status.SetDevelWorkingName("devel")
// c.status.SetUserWorkingName("jcarr")
c.status.Update() c.status.Update()
cbname := c.status.GetCurrentBranchName() cbname := c.status.GetCurrentBranchName()
@ -71,17 +76,23 @@ func (c *controlBox) addRepo(path string) {
c.dirtyL.SetText("false") 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) c.Version.SetText(debversion)
lasttag := c.status.GetLastTagVersion()
c.lastTag.SetText(lasttag) c.lastTag.SetText(lasttag)
c.currentL.SetText(cbname + " " + cbversion) c.currentL.SetText(cbname + " " + cbversion)
tagDate := c.getDateStamp(lasttag) tagDate := c.getDateStamp(lasttag)
c.tagDate.SetText(tagDate) c.tagDate.SetText(tagDate)
if c.status.Changed() { if s, ok := c.status.Changed(); ok {
log.Warn("should scan here") log.Warn("should scan here", s)
} }
return return

View File

@ -13,9 +13,10 @@ import (
) )
var args struct { var args struct {
NoGui bool `arg:"--no-gui" help:"don't open the gui, just make the .deb"` 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"` Repo string `arg:"--repo" help:"go get path to the repo"`
PkgDir string `arg:"--pkg-dir" help:"set default directory (~/incoming/)"` 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() { func init() {

View File

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

View File

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

View File

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