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") diff --git a/flake.nix b/flake.nix index 4de35204..09520be2 100644 --- a/flake.nix +++ b/flake.nix @@ -139,7 +139,6 @@ GOCACHE="$(mktemp -d)" \ PATH="${pkgs.pkgsStatic.musl.bin}/bin:$PATH" \ DESTDIR="$out" \ - HAKUREI_VERSION="v${hakurei.version}" \ ./all.sh ''; }