#!/bin/bash set -e # logpile Release Build Script # Creates binaries for selected platforms and packages them for release # Colors RED='\033[0;31m' GREEN='\033[0;32m' YELLOW='\033[1;33m' NC='\033[0m' # No Color # Get version from git VERSION=$(git describe --tags --always --dirty 2>/dev/null || echo "dev") if [[ $VERSION == *"dirty"* ]] && [[ "${ALLOW_DIRTY}" != "1" ]]; then echo -e "${RED}Error: Working directory has uncommitted changes${NC}" echo "Commit your changes first (or run with ALLOW_DIRTY=1)" exit 1 fi echo -e "${GREEN}Building logpile version: ${VERSION}${NC}" echo "" # Stable build env for this machine/toolchain export GOPATH="${GOPATH:-/tmp/go}" export GOCACHE="${GOCACHE:-/tmp/gocache}" # Use the locally installed Go toolchain by default. # A pinned or auto-downloaded toolchain can still be requested via env override. export GOTOOLCHAIN="${GOTOOLCHAIN:-local}" mkdir -p "${GOPATH}" "${GOCACHE}" # Create release directory RELEASE_DIR="releases/${VERSION}" mkdir -p "${RELEASE_DIR}" # Create release notes template (always include macOS Gatekeeper note) if [ ! -f "${RELEASE_DIR}/RELEASE_NOTES.md" ]; then cat > "${RELEASE_DIR}/RELEASE_NOTES.md" < SHA256SUMS.txt 2>/dev/null || shasum -a 256 * | grep -v SHA256SUMS > SHA256SUMS.txt cd ../.. echo -e "${GREEN} ✓ SHA256SUMS.txt${NC}" # List release files echo "" echo -e "${GREEN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}" echo -e "${GREEN}Release ${VERSION} built successfully!${NC}" echo -e "${GREEN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}" echo "" echo "Files in ${RELEASE_DIR}:" ls -lh "${RELEASE_DIR}" echo "" # Show next steps echo -e "${YELLOW}Next steps:${NC}" echo " 1. Create git tag:" echo " git tag -a ${VERSION} -m \"Release ${VERSION}\"" echo "" echo " 2. Push tag to remote:" echo " git push origin ${VERSION}" echo "" echo " 3. Create release on git.mchus.pro:" echo " - Go to: https://git.mchus.pro/mchus/logpile/releases" echo " - Click 'New Release'" echo " - Select tag: ${VERSION}" echo " - Upload files from: ${RELEASE_DIR}/" echo "" echo -e "${GREEN}Done!${NC}"