aboutsummaryrefslogtreecommitdiffhomepage
path: root/cmd
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2026-05-21 23:34:50 +0900
committerOphestra <cat@gensokyo.uk>2026-05-21 23:37:08 +0900
commit2a9aa3b4007a73a6c9d4608cb9a8822247881fd6 (patch)
treed3e448cdf5f285bbdb83acf036bbdba47a0a72cd /cmd
parent68a91523b9e58ee8a9f86723d616e82c0645b64a (diff)
cmd/dist: include version in release
This makes HAKUREI_VERSION optional during build. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'cmd')
-rw-r--r--cmd/dist/VERSION1
-rw-r--r--cmd/dist/main.go7
2 files changed, 7 insertions, 1 deletions
diff --git a/cmd/dist/VERSION b/cmd/dist/VERSION
new file mode 100644
index 00000000..0eec13e4
--- /dev/null
+++ b/cmd/dist/VERSION
@@ -0,0 +1 @@
+v0.4.2
diff --git a/cmd/dist/main.go b/cmd/dist/main.go
index 9ed7f2f8..d876cf83 100644
--- a/cmd/dist/main.go
+++ b/cmd/dist/main.go
@@ -18,8 +18,13 @@ import (
"os/signal"
"path/filepath"
"runtime"
+ "strings"
)
+//go:generate sh -c "git describe --tags > VERSION"
+//go:embed VERSION
+var version string
+
// getenv looks up an environment variable, and returns fallback if it is unset.
func getenv(key, fallback string) string {
if v, ok := os.LookupEnv(key); ok {
@@ -47,7 +52,7 @@ func main() {
verbose := os.Getenv("VERBOSE") != ""
runTests := os.Getenv("HAKUREI_DIST_MAKE") == ""
- version := getenv("HAKUREI_VERSION", "untagged")
+ version = getenv("HAKUREI_VERSION", strings.TrimSpace(version))
prefix := getenv("PREFIX", "/usr")
destdir := getenv("DESTDIR", "dist")