Skip to content

Commit 2da7079

Browse files
authored
Merge pull request #176 from HappyHackingSpace/fix/constant-version
fix constant version in build
2 parents 80e8c31 + 64b1e5b commit 2da7079

2 files changed

Lines changed: 8 additions & 9 deletions

File tree

.github/workflows/tests.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ jobs:
104104
105105
for ARCH in amd64 386 arm arm64; do
106106
GOOS=linux GOARCH=$ARCH CGO_ENABLED=0 go build \
107-
-ldflags="-s -w" -o vt ./cmd/vt/main.go
107+
-ldflags="-s -w -X 'github.com/happyhackingspace/vt/internal/banner.AppVersion=${GITHUB_REF_NAME}'" -o vt ./cmd/vt/main.go
108108
zip "vt_${VERSION}_linux_${ARCH}.zip" vt
109109
rm vt
110110
done
@@ -140,7 +140,7 @@ jobs:
140140
141141
for ARCH in amd64 386 arm64; do
142142
GOOS=windows GOARCH=$ARCH CGO_ENABLED=0 go build \
143-
-ldflags="-s -w" -o vt.exe ./cmd/vt/main.go
143+
-ldflags="-s -w -X 'github.com/happyhackingspace/vt/internal/banner.AppVersion=${GITHUB_REF_NAME}'" -o vt.exe ./cmd/vt/main.go
144144
zip "vt_${VERSION}_windows_${ARCH}.zip" vt.exe
145145
rm vt.exe
146146
done
@@ -176,7 +176,7 @@ jobs:
176176
177177
for ARCH in amd64 arm64; do
178178
CGO_ENABLED=1 GOOS=darwin GOARCH=$ARCH go build \
179-
-ldflags="-s -w" -o vt ./cmd/vt/main.go
179+
-ldflags="-s -w -X 'github.com/happyhackingspace/vt/internal/banner.AppVersion=${GITHUB_REF_NAME}'" -o vt ./cmd/vt/main.go
180180
zip "vt_${VERSION}_macOS_${ARCH}.zip" vt
181181
rm vt
182182
done

internal/banner/banner.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,11 @@ import (
1515
"golang.org/x/term"
1616
)
1717

18-
const (
19-
// AppName is the application name.
20-
AppName = "vt"
21-
// AppVersion is the application version.
22-
AppVersion = "v0.0.1"
23-
)
18+
// AppName is the application name.
19+
const AppName = "vt"
20+
21+
// AppVersion is the application version, injected at build time via -ldflags.
22+
var AppVersion = "dev"
2423

2524
// DANGER (#FF3355) base RGB — matching JS DANGER_RGB.
2625
const (

0 commit comments

Comments
 (0)