mirror of
https://github.com/Finesssee/ProxyPilot.git
synced 2026-11-19 02:17:46 +00:00
build(scripts): embed version info in macOS build script
Use git describe/rev-parse for version/commit and pass via ldflags.
This commit is contained in:
@@ -8,11 +8,20 @@ compat_path="$out_dir/cliproxyapi-latest"
|
||||
|
||||
mkdir -p "$out_dir"
|
||||
|
||||
echo "Building ProxyPilot Engine..."
|
||||
echo " out: $out_path"
|
||||
echo " compat: $compat_path"
|
||||
# Version info from git
|
||||
VERSION="${VERSION:-$(git -C "$repo_root" describe --tags --always 2>/dev/null || echo "dev")}"
|
||||
COMMIT="${COMMIT:-$(git -C "$repo_root" rev-parse --short HEAD 2>/dev/null || echo "none")}"
|
||||
BUILD_DATE="${BUILD_DATE:-$(date -u +"%Y-%m-%dT%H:%M:%SZ")}"
|
||||
|
||||
(cd "$repo_root" && go build -o "$out_path" ./cmd/server)
|
||||
LDFLAGS="-X main.Version=$VERSION -X main.Commit=$COMMIT -X main.BuildDate=$BUILD_DATE"
|
||||
|
||||
echo "Building ProxyPilot Engine..."
|
||||
echo " version: $VERSION"
|
||||
echo " commit: $COMMIT"
|
||||
echo " built: $BUILD_DATE"
|
||||
echo " out: $out_path"
|
||||
|
||||
(cd "$repo_root" && go build -ldflags "$LDFLAGS" -o "$out_path" ./cmd/server)
|
||||
cp -f "$out_path" "$compat_path" 2>/dev/null || true
|
||||
|
||||
echo "Done."
|
||||
|
||||
Reference in New Issue
Block a user