diff --git a/nix/pkgs/watgbridge-dev.nix b/nix/pkgs/watgbridge-dev.nix index f0f1b90..7e18434 100644 --- a/nix/pkgs/watgbridge-dev.nix +++ b/nix/pkgs/watgbridge-dev.nix @@ -28,7 +28,7 @@ let in buildGoApplication rec { pname = "watgbridge"; - version = "1.11.0"; + version = (lib.trim (builtins.readFile ../../state/version.txt)); pwd = localSrc; src = localSrc; diff --git a/state/state.go b/state/state.go index 35066bf..40a97cf 100644 --- a/state/state.go +++ b/state/state.go @@ -1,6 +1,8 @@ package state import ( + _ "embed" + "strings" "time" "github.com/PaulSonOfLars/gotgbot/v2" @@ -10,7 +12,8 @@ import ( "gorm.io/gorm" ) -const WATGBRIDGE_VERSION = "1.11.0" +//go:embed version.txt +var WATGBRIDGE_VERSION string type state struct { Config *Config @@ -33,5 +36,6 @@ type state struct { var State state func init() { + WATGBRIDGE_VERSION = strings.TrimSpace(WATGBRIDGE_VERSION) State.Config = &Config{Path: "config.yaml"} } diff --git a/state/version.txt b/state/version.txt new file mode 100644 index 0000000..1cac385 --- /dev/null +++ b/state/version.txt @@ -0,0 +1 @@ +1.11.0