feat: add gdu static musl build + generalize publish_release.py
gdu static musl build / build-and-release (push) Failing after 39s
iperf3 static musl build / build-and-release (push) Successful in 20s

This commit is contained in:
Hermes Agent
2026-05-07 23:31:59 +00:00
parent 8cbc66227f
commit 37968e48fc
5 changed files with 132 additions and 3 deletions
+57
View File
@@ -0,0 +1,57 @@
#!/bin/sh
set -eu
VERSION="${1:?usage: build_gdu.sh <version> [output_dir]}"
OUTPUT_DIR="${2:-$PWD/dist}"
PREFIX_NAME="gdu-${VERSION}-linux-amd64-musl-static"
# strip leading 'v' if passed
VERSION="${VERSION#v}"
mkdir -p "$OUTPUT_DIR"
apk add --no-cache \
curl \
file \
go \
git \
tar \
xz
# gdu uses Go modules, pull source from GitHub
SRCDIR="${TMPDIR:-/tmp}/gdu-src-${VERSION}"
rm -rf "$SRCDIR"
mkdir -p "$SRCDIR"
curl -fsSL "https://github.com/dundee/gdu/archive/refs/tags/v${VERSION}.tar.gz" \
| tar -xz -C "$SRCDIR" --strip-components=1
cd "$SRCDIR"
# Build fully static with musl toolchain
# CGO_ENABLED=0 forces pure-Go, which means no C deps at all
# ldflags: strip debug + disable dynamic linking
CGO_ENABLED=0 GOARCH=amd64 GOOS=linux \
go build \
-trimpath \
-ldflags="-s -w -extldflags=-static" \
-o "$OUTPUT_DIR/$PREFIX_NAME" \
./cmd/gdu
strip "$OUTPUT_DIR/$PREFIX_NAME" 2>/dev/null || true
(
cd "$OUTPUT_DIR"
tar -czf "${PREFIX_NAME}.tar.gz" "$PREFIX_NAME"
sha256sum "$PREFIX_NAME" "${PREFIX_NAME}.tar.gz" > "${PREFIX_NAME}.sha256"
)
file "$OUTPUT_DIR/$PREFIX_NAME"
ldd "$OUTPUT_DIR/$PREFIX_NAME" || true
if file "$OUTPUT_DIR/$PREFIX_NAME" | grep -qi 'dynamically linked'; then
echo "error: output binary is still dynamically linked" >&2
exit 1
fi
echo "build OK: $OUTPUT_DIR/$PREFIX_NAME"
+4 -3
View File
@@ -93,10 +93,11 @@ def main() -> int:
if missing:
raise SystemExit(f"missing files: {', '.join(missing)}")
tag = f"iperf3-v{version}"
title = f"iperf3 {version}"
tool = os.environ.get("TOOL", "iperf3")
tag = f"{tool}-v{version}"
title = f"{tool} {version}"
body = (
f"Static musl build for iperf3 {version}.\\n\\n"
f"Static musl build for {tool} {version}.\\n\\n"
f"Repository: {owner}/{repo}\\n"
f"Commit: {target}"
)