Skip to content

Commit

Permalink
Merge pull request #4 from woehrl01/feature/versioning
Browse files Browse the repository at this point in the history
Display current build version and git hash
  • Loading branch information
woehrl01 committed Oct 13, 2019
2 parents f8908c1 + 100d92d commit fbffbd1
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
run: getdeps.cmd

- name: Build
run: build.cmd
run: build.ps1

- name: Run tests
run: test.cmd
1 change: 0 additions & 1 deletion build.cmd

This file was deleted.

5 changes: 5 additions & 0 deletions build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
$now = Get-Date -UFormat "%Y-%m-%d_%T"
$sha1 = (git rev-parse HEAD).Trim().Substring(0, 8)
$version = (git describe --tags $(git rev-list --tags --max-count=1)).Trim()

go build -ldflags "-X main.sha1ver=$sha1 -X main.buildTime=$now -X main.semVer=$version -H=windowsgui" -o Kalenderwoche.exe
8 changes: 7 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ import (
"github.com/goodsign/monday"
)

var (
sha1ver string // sha1 revision used to build the program
buildTime string // when the executable was built
semVer string // the version of the build
)

func main() {
enableDpiAwareness()

Expand Down Expand Up @@ -49,7 +55,7 @@ func keepWeekNumberIconUpToDate() {
}

func quitOnMenu() {
quitMenuItem := systray.AddMenuItem("Beenden", "Beendet die Applikation")
quitMenuItem := systray.AddMenuItem(fmt.Sprintf("Beenden (%s - %s)", semVer, sha1ver), "Beendet die Applikation")
<-quitMenuItem.ClickedCh
systray.Quit()
}
Expand Down

0 comments on commit fbffbd1

Please sign in to comment.