mirror of
https://github.com/ddworken/hishtory.git
synced 2025-01-11 16:58:47 +01:00
Add version to binary
This commit is contained in:
parent
caf7889c06
commit
2bb06b568a
2
Makefile
2
Makefile
@ -3,9 +3,9 @@ test:
|
||||
|
||||
release:
|
||||
expr `cat VERSION` + 1 > VERSION
|
||||
git tag v0.`cat VERSION`
|
||||
git add VERSION
|
||||
git commit -m "Bump hishtory version"
|
||||
git tag v0.`cat VERSION`
|
||||
git push
|
||||
git push --tags
|
||||
|
||||
|
@ -188,7 +188,7 @@ func testIntegration(t *testing.T) string {
|
||||
out := RunInteractiveBashCommands(t, `
|
||||
hishtory status
|
||||
`)
|
||||
if out != fmt.Sprintf("Hishtory: e2e sync\nEnabled: true\nSecret Key: %s\nCommit Hash: Unknown\n", userSecret) {
|
||||
if out != fmt.Sprintf("Hishtory: v0.Unknown\nEnabled: true\nSecret Key: %s\nCommit Hash: Unknown\n", userSecret) {
|
||||
t.Fatalf("status command has unexpected output: %#v", out)
|
||||
}
|
||||
|
||||
@ -363,7 +363,7 @@ func TestUpdate(t *testing.T) {
|
||||
|
||||
// Check the status command
|
||||
out := RunInteractiveBashCommands(t, `hishtory status`)
|
||||
if out != fmt.Sprintf("Hishtory: e2e sync\nEnabled: true\nSecret Key: %s\nCommit Hash: Unknown\n", userSecret) {
|
||||
if out != fmt.Sprintf("Hishtory: v0.Unknown\nEnabled: true\nSecret Key: %s\nCommit Hash: Unknown\n", userSecret) {
|
||||
t.Fatalf("status command has unexpected output: %#v", out)
|
||||
}
|
||||
|
||||
@ -372,7 +372,7 @@ func TestUpdate(t *testing.T) {
|
||||
|
||||
// Then check the status command again to confirm the update worked
|
||||
out = RunInteractiveBashCommands(t, `hishtory status`)
|
||||
if !strings.HasPrefix(out, fmt.Sprintf("Hishtory: e2e sync\nEnabled: true\nSecret Key: %s\nCommit Hash: ", userSecret)) {
|
||||
if !strings.HasPrefix(out, fmt.Sprintf("Hishtory: v0.Unknown\nEnabled: true\nSecret Key: %s\nCommit Hash: ", userSecret)) {
|
||||
t.Fatalf("status command has unexpected output: %#v", out)
|
||||
}
|
||||
if strings.Contains(out, "\nCommit Hash: Unknown\n") {
|
||||
|
@ -16,7 +16,10 @@ import (
|
||||
"github.com/ddworken/hishtory/shared"
|
||||
)
|
||||
|
||||
var GitCommit string = "Unknown"
|
||||
var (
|
||||
GitCommit string = "Unknown"
|
||||
Version string = "Unknown"
|
||||
)
|
||||
|
||||
func main() {
|
||||
if len(os.Args) == 1 {
|
||||
@ -41,7 +44,7 @@ func main() {
|
||||
case "status":
|
||||
config, err := lib.GetConfig()
|
||||
lib.CheckFatalError(err)
|
||||
fmt.Print("Hishtory: e2e sync\nEnabled: ")
|
||||
fmt.Print("Hishtory: v0." + Version + "\nEnabled: ")
|
||||
fmt.Print(config.IsEnabled)
|
||||
fmt.Print("\nSecret Key: ")
|
||||
fmt.Print(config.UserSecret)
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
GIT_HASH=$(git rev-parse HEAD)
|
||||
echo "-X main.GitCommit=$GIT_HASH -w -extldflags \"-static\""
|
||||
echo "-X main.GitCommit=$GIT_HASH -X main.Version=`cat VERSION` -w -extldflags \"-static\""
|
||||
|
Loading…
Reference in New Issue
Block a user