mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-09-22 19:23:31 +00:00
ac67642aef
- ALL archives now use bin/pulse structure (including architecture-specific) - Matches what Proxmox community script expects - Install script checks bin/ first, falls back to root for old archives - Eliminates confusion from having two different structures - One consistent path forward: archives have bin/ directory
119 lines
3.2 KiB
Bash
Executable File
119 lines
3.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# Build script for Pulse releases
|
|
# Creates release archives for different architectures
|
|
|
|
set -euo pipefail
|
|
|
|
# Use Go 1.23 if available
|
|
if [ -x /usr/local/go/bin/go ]; then
|
|
export PATH=/usr/local/go/bin:$PATH
|
|
fi
|
|
|
|
VERSION=${1:-$(cat VERSION)}
|
|
BUILD_DIR="build"
|
|
RELEASE_DIR="release"
|
|
|
|
echo "Building Pulse v${VERSION}..."
|
|
|
|
# Clean previous builds
|
|
rm -rf $BUILD_DIR $RELEASE_DIR
|
|
mkdir -p $BUILD_DIR $RELEASE_DIR
|
|
|
|
# Build frontend
|
|
echo "Building frontend..."
|
|
cd frontend-modern
|
|
npm ci
|
|
npm run build
|
|
cd ..
|
|
|
|
# Copy frontend to api directory for embedding
|
|
echo "Copying frontend for embedding..."
|
|
rm -rf internal/api/frontend-modern
|
|
cp -r frontend-modern internal/api/
|
|
|
|
# Build for different architectures
|
|
declare -A builds=(
|
|
["linux-amd64"]="GOOS=linux GOARCH=amd64"
|
|
["linux-arm64"]="GOOS=linux GOARCH=arm64"
|
|
["linux-armv7"]="GOOS=linux GOARCH=arm GOARM=7"
|
|
)
|
|
|
|
for build_name in "${!builds[@]}"; do
|
|
echo "Building for $build_name..."
|
|
|
|
# Get build environment
|
|
build_env="${builds[$build_name]}"
|
|
|
|
# Build binary
|
|
env $build_env go build \
|
|
-ldflags="-s -w -X github.com/rcourtman/pulse-go-rewrite/internal/updates.version=${VERSION}" \
|
|
-trimpath \
|
|
-o "$BUILD_DIR/pulse-$build_name" \
|
|
./cmd/pulse
|
|
|
|
# Create release archive
|
|
tar_name="pulse-v${VERSION}-${build_name}.tar.gz"
|
|
|
|
# Create staging directory with bin/ structure (matches what community script expects)
|
|
staging_dir="$BUILD_DIR/pulse-staging"
|
|
rm -rf "$staging_dir"
|
|
mkdir -p "$staging_dir/bin"
|
|
|
|
# Copy files to match universal archive structure
|
|
cp "$BUILD_DIR/pulse-$build_name" "$staging_dir/bin/pulse"
|
|
cp README.md LICENSE install.sh "$staging_dir/"
|
|
echo "$VERSION" > "$staging_dir/VERSION"
|
|
|
|
# Create tarball
|
|
cd "$staging_dir"
|
|
tar -czf "../../$RELEASE_DIR/$tar_name" .
|
|
cd ../..
|
|
|
|
# Cleanup staging
|
|
rm -rf "$staging_dir"
|
|
|
|
echo "Created $RELEASE_DIR/$tar_name"
|
|
done
|
|
|
|
echo "Architecture-specific releases built!"
|
|
|
|
# Create universal release tarball with all architectures
|
|
echo "Creating universal release tarball..."
|
|
universal_staging="$BUILD_DIR/pulse-staging"
|
|
rm -rf "$universal_staging"
|
|
mkdir -p "$universal_staging/bin"
|
|
|
|
# Copy all architecture binaries to bin/
|
|
for build_name in "${!builds[@]}"; do
|
|
cp "$BUILD_DIR/pulse-$build_name" "$universal_staging/bin/pulse-$build_name"
|
|
done
|
|
|
|
# Use amd64 binary as default 'pulse' for seamless usage
|
|
cp "$BUILD_DIR/pulse-linux-amd64" "$universal_staging/bin/pulse"
|
|
chmod +x "$universal_staging/bin/pulse"
|
|
|
|
# Copy common files (frontend is now embedded, no need to copy dist)
|
|
cp README.md LICENSE install.sh "$universal_staging/" 2>/dev/null || true
|
|
echo "$VERSION" > "$universal_staging/VERSION"
|
|
|
|
# Create first-run cleanup flag
|
|
touch "$universal_staging/.first-run-cleanup"
|
|
|
|
# Create the universal tarball (this is what the community script expects)
|
|
cd "$universal_staging"
|
|
tar -czf "../../$RELEASE_DIR/pulse-v${VERSION}.tar.gz" .
|
|
cd ../..
|
|
|
|
# Cleanup
|
|
rm -rf "$universal_staging"
|
|
|
|
echo "Created universal release: $RELEASE_DIR/pulse-v${VERSION}.tar.gz"
|
|
|
|
# Update checksums
|
|
cd $RELEASE_DIR
|
|
sha256sum *.tar.gz > checksums.txt
|
|
cd ..
|
|
|
|
echo "Final release contents:"
|
|
ls -lh $RELEASE_DIR/ |