chore: take the version from VERSION.txt only (0.0.3)

VERSION.txt is embedded into the server and the agent, so a plain
go build reports the real version and build.sh no longer injects it.
This commit is contained in:
redtea committed 2026-10-13 14:50:49 +03:00
1 parent 93673d3570
commit 7cb9da8569
5 files changed
+26 -11

No files matched your search

+1 -1
View File
@@ -1 +1 @@
0.0.2 0.0.3
+3 -4
View File
@@ -5,10 +5,9 @@ set -eu
cd "$(dirname "$0")" cd "$(dirname "$0")"
VERSION="${VERSION:-$(cat VERSION.txt 2>/dev/null || echo 0.0.0)}" # The version comes from VERSION.txt, which is embedded into every binary.
PKG="github.com/x-grk/longpolling-remote-access" LDFLAGS="-s -w"
LDFLAGS="-s -w -X $PKG/internal/server.Version=$VERSION -X $PKG/internal/agent.Version=$VERSION" echo ">> version $(cat VERSION.txt)"
echo ">> version $VERSION"
mkdir -p dist bin mkdir -p dist bin
+3 -3
View File
@@ -18,12 +18,12 @@ import (
"runtime" "runtime"
"time" "time"
lpra "github.com/x-grk/longpolling-remote-access"
"github.com/x-grk/longpolling-remote-access/internal/proto" "github.com/x-grk/longpolling-remote-access/internal/proto"
) )
// Version is the agent build version, injected at compile time via -ldflags // Version is the agent build version (see VERSION.txt).
// (-X .../internal/agent.Version=...). var Version = lpra.Version
var Version = "dev"
// Config is the agent's runtime configuration (from env / config.env). // Config is the agent's runtime configuration (from env / config.env).
type Config struct { type Config struct {
+5 -3
View File
@@ -3,6 +3,8 @@ package server
import ( import (
"crypto/rand" "crypto/rand"
"encoding/hex" "encoding/hex"
lpra "github.com/x-grk/longpolling-remote-access"
) )
// Config keys stored in the config table. // Config keys stored in the config table.
@@ -18,9 +20,9 @@ const (
// the rendered install.sh and can be changed from the settings page. // the rendered install.sh and can be changed from the settings page.
const DefaultHostAddress = "https://REDACTED:8445" const DefaultHostAddress = "https://REDACTED:8445"
// Version is the server build version, injected at compile time via -ldflags // Version is the server build version (see VERSION.txt). It is the newest
// (-X .../internal/server.Version=...). It is the newest version agents update to. // version agents update to.
var Version = "dev" var Version = lpra.Version
// ensureDefaults seeds the host address and a random enroll secret on first boot. // ensureDefaults seeds the host address and a random enroll secret on first boot.
func (db *DB) ensureDefaults() error { func (db *DB) ensureDefaults() error {
+14
View File
@@ -0,0 +1,14 @@
// Package lpra holds what the server and the agent share at build time.
package lpra
import (
_ "embed"
"strings"
)
//go:embed VERSION.txt
var versionFile string
// Version is the release version of every binary in this module. VERSION.txt
// is the only place it is defined.
var Version = strings.TrimSpace(versionFile)