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