From 1bce8086d6b186bbe95ceaa0277fbe8ba28ac2b4 Mon Sep 17 00:00:00 2001 From: Mikhail Chusavitin Date: Tue, 3 Feb 2026 10:58:41 +0300 Subject: [PATCH] feat: add release build script for multi-platform binaries - Add scripts/release.sh for automated release builds - Creates tar.gz packages for Linux and macOS - Generates SHA256 checksums - Add 'make release' target - Add releases/ to .gitignore Usage: make release # Build and package for all platforms Output: releases/v0.2.5/*.tar.gz + SHA256SUMS.txt Co-Authored-By: Claude Sonnet 4.5 --- .gitignore | 1 + Makefile | 5 +++ scripts/release.sh | 92 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 98 insertions(+) create mode 100755 scripts/release.sh diff --git a/.gitignore b/.gitignore index 9074675..c2293af 100644 --- a/.gitignore +++ b/.gitignore @@ -41,3 +41,4 @@ Network Trash Folder Temporary Items .apdisk +releases/ diff --git a/Makefile b/Makefile index 6a4a29f..ed8c388 100644 --- a/Makefile +++ b/Makefile @@ -36,6 +36,10 @@ build-macos: # Build all platforms build-all: build-release build-linux build-macos +# Create release packages for all platforms +release: + @./scripts/release.sh + # Show version version: @echo "Version: $(VERSION)" @@ -74,6 +78,7 @@ help: @echo " build-linux Cross-compile for Linux" @echo " build-macos Cross-compile for macOS (Intel + Apple Silicon)" @echo " build-all Build for all platforms" + @echo " release Create release packages for all platforms" @echo " version Show current version" @echo " clean Remove build artifacts" @echo " test Run tests" diff --git a/scripts/release.sh b/scripts/release.sh new file mode 100755 index 0000000..31349bb --- /dev/null +++ b/scripts/release.sh @@ -0,0 +1,92 @@ +#!/bin/bash +set -e + +# QuoteForge Release Build Script +# Creates binaries for all 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"* ]]; then + echo -e "${RED}✗ Error: Working directory has uncommitted changes${NC}" + echo " Commit your changes first" + exit 1 +fi + +echo -e "${GREEN}Building QuoteForge version: ${VERSION}${NC}" +echo "" + +# Create release directory +RELEASE_DIR="releases/${VERSION}" +mkdir -p "${RELEASE_DIR}" + +# Build for all platforms +echo -e "${YELLOW}→ Building binaries...${NC}" +make build-all + +# Package binaries with checksums +echo "" +echo -e "${YELLOW}→ Creating release packages...${NC}" + +# Linux AMD64 +if [ -f "bin/qfs-linux-amd64" ]; then + cd bin + tar -czf "../${RELEASE_DIR}/qfs-${VERSION}-linux-amd64.tar.gz" qfs-linux-amd64 + cd .. + echo -e "${GREEN} ✓ qfs-${VERSION}-linux-amd64.tar.gz${NC}" +fi + +# macOS Intel +if [ -f "bin/qfs-darwin-amd64" ]; then + cd bin + tar -czf "../${RELEASE_DIR}/qfs-${VERSION}-darwin-amd64.tar.gz" qfs-darwin-amd64 + cd .. + echo -e "${GREEN} ✓ qfs-${VERSION}-darwin-amd64.tar.gz${NC}" +fi + +# macOS Apple Silicon +if [ -f "bin/qfs-darwin-arm64" ]; then + cd bin + tar -czf "../${RELEASE_DIR}/qfs-${VERSION}-darwin-arm64.tar.gz" qfs-darwin-arm64 + cd .. + echo -e "${GREEN} ✓ qfs-${VERSION}-darwin-arm64.tar.gz${NC}" +fi + +# Generate checksums +echo "" +echo -e "${YELLOW}→ Generating checksums...${NC}" +cd "${RELEASE_DIR}" +shasum -a 256 *.tar.gz > 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/QuoteForge/releases" +echo " - Click 'New Release'" +echo " - Select tag: ${VERSION}" +echo " - Upload files from: ${RELEASE_DIR}/" +echo "" +echo -e "${GREEN}Done!${NC}"