refactor: move V1 code into v1/ subdirectory
- git mv cmd/ internal/ pkg/ test/ go.mod go.sum Makefile build.sh docs/ v1/ - Create v1/README.md with V1 documentation - Update root README for V1 + V2 structure - V1 still builds (cd v1 && go build ./cmd/hostkeeper) and 105 tests pass - Root is now clean for V2 development
This commit is contained in:
Executable
+48
@@ -0,0 +1,48 @@
|
||||
#!/bin/bash
|
||||
# Build script for multiple platforms
|
||||
set -e
|
||||
|
||||
VERSION=${VERSION:-$(git describe --tags --always --dirty 2>/dev/null || echo "dev")}
|
||||
BUILD_DIR=${BUILD_DIR:-"build"}
|
||||
BINARY_NAME="hostkeeper"
|
||||
|
||||
echo "Building Hostkeeper v${VERSION}"
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
|
||||
rm -rf ${BUILD_DIR}
|
||||
mkdir -p ${BUILD_DIR}
|
||||
|
||||
platforms=(
|
||||
"linux/amd64"
|
||||
"linux/arm64"
|
||||
"linux/arm"
|
||||
"darwin/amd64"
|
||||
"darwin/arm64"
|
||||
"windows/amd64"
|
||||
)
|
||||
|
||||
for platform in "${platforms[@]}"; do
|
||||
IFS='/' read -r os arch <<< "$platform"
|
||||
|
||||
output_name="${BINARY_NAME}-${os}-${arch}"
|
||||
if [ "$os" = "windows" ]; then
|
||||
output_name="${output_name}.exe"
|
||||
fi
|
||||
|
||||
echo " Building for ${os}/${arch}..."
|
||||
|
||||
GOOS=$os GOARCH=$arch go build \
|
||||
-ldflags "-X main.version=${VERSION} -X main.buildTime=$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
|
||||
-o "${BUILD_DIR}/${output_name}" \
|
||||
./cmd/hostkeeper
|
||||
|
||||
if command -v shasum &> /dev/null; then
|
||||
(cd ${BUILD_DIR} && shasum -a 256 "${output_name}" > "${output_name}.sha256")
|
||||
fi
|
||||
done
|
||||
|
||||
echo ""
|
||||
echo "Build complete! Binaries in ${BUILD_DIR}/"
|
||||
echo ""
|
||||
echo "Available binaries:"
|
||||
ls -lh ${BUILD_DIR}/
|
||||
Reference in New Issue
Block a user