Skip to content

armgit / ARTEX

Public Imported from GitHub
0

ARTEX - AI autonomous penetration testing system (English translation; upstream: Autumn-27/ARTEX, AGPL-3.0)

revert: 恢复版本号动态注入,本地构建回退为 dev

Autumn-27a70d2377cad5
diff --git a/build.sh b/build.sh
index 52ba0b6..e8efac8 100755
--- a/build.sh
+++ b/build.sh
@@ -8,7 +8,7 @@
# ARTEX_TARGET_OS=linux One target OS in single-target mode.
# ARTEX_TARGET_ARCH=amd64 One target arch in single-target mode.
# ARTEX_TARGETS=linux/amd64,... Comma-separated targets for multi-target mode.
-# ARTEX_BUILD_VERSION=0.3.3 Version embedded in the binary and archive name.
+# ARTEX_BUILD_VERSION=v0.3.3 Version embedded in the binary and archive name.
# ARTEX_OUTPUT=/path/to/artex Explicit binary path in single-target mode.
# ARTEX_OUTPUT_DIR=dist Directory for default binary paths.
# ARTEX_PACKAGE=1 Create a zip archive for each target.
@@ -90,7 +90,13 @@ done
command -v go >/dev/null 2>&1 || die "未检测到 Go(项目需要 Go 1.26 或更高版本)"
ARTEX_GOSUMDB="${ARTEX_GOSUMDB:-sum.golang.org}"
-ARTEX_BUILD_VERSION="${ARTEX_BUILD_VERSION:-0.3.3}"
+if [ -z "${ARTEX_BUILD_VERSION:-}" ]; then
+ if command -v git >/dev/null 2>&1 && git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
+ ARTEX_BUILD_VERSION="$(git describe --tags --always --dirty)"
+ else
+ ARTEX_BUILD_VERSION="dev"
+ fi
+fi
# Release tags are commonly passed as v0.3.3; keep the binary version consistent.
ARTEX_BUILD_VERSION="${ARTEX_BUILD_VERSION#v}"
ARTEX_OUTPUT_DIR="${ARTEX_OUTPUT_DIR:-dist}"
diff --git a/cmd/artex/main.go b/cmd/artex/main.go
index 6023245..cbc5b42 100644
--- a/cmd/artex/main.go
+++ b/cmd/artex/main.go
@@ -21,9 +21,9 @@ import (
"github.com/Autumn-27/artex/server"
)
-// version is the application version. Release builds may override it via
-// -ldflags "-X main.version=<version>".
-var version = "0.3.3"
+// version is the build version, injected at release time via
+// -ldflags "-X main.version=<tag>". Defaults to "dev" for local builds.
+var version = "dev"
const banner = `
_ ____ _____ _______ __