diff --git a/.gitea/workflows/unreal-build.yml b/.gitea/workflows/unreal-build.yml index 0ea0dd63..98e3c1be 100644 --- a/.gitea/workflows/unreal-build.yml +++ b/.gitea/workflows/unreal-build.yml @@ -188,49 +188,188 @@ jobs: chmod +x ./mac_build.sh ./mac_build.sh - - name: Prepare Mac release + - name: Prepare Mac release with chunking run: | echo "Preparing packaged files for release..." - # Create a directory for release files - mkdir -p PackagedReleases - - # Debug: Show what we're packaging - echo "=== Packaging for Release ===" - echo "Build directory contents:" - ls -la Builds/ + # Create directories for packaging + mkdir -p PackagedReleases/chunks # Find the app bundle in the Builds directory APP_PATH=$(find Builds -type d -name "*.app" | head -1) + BUILD_DIR="" + ZIP_BASE_NAME="" if [ -n "$APP_PATH" ]; then echo "Found app bundle: $APP_PATH" - # Get the app name + BUILD_DIR=$(dirname "$APP_PATH") APP_NAME=$(basename "$APP_PATH") - # Create zip file of the app bundle - (cd $(dirname "$APP_PATH") && zip -r "../../PackagedReleases/${APP_NAME%.app}-macOS.zip" "$APP_NAME") - echo "Created packaged release: PackagedReleases/${APP_NAME%.app}-macOS.zip" + ZIP_BASE_NAME="${APP_NAME%.app}-macOS" else - echo "No .app bundle found in Builds directory" + echo "No .app bundle found, searching for other build directories" - # Look for a directory that might be a bundle but not named .app + # Look for a directory that might be a build output MAIN_BUILD_DIR=$(find Builds -mindepth 1 -maxdepth 1 -type d | head -1) if [ -n "$MAIN_BUILD_DIR" ]; then echo "Found main build directory: $MAIN_BUILD_DIR" + BUILD_DIR=$(dirname "$MAIN_BUILD_DIR") DIR_NAME=$(basename "$MAIN_BUILD_DIR") - # Package this directory as if it were the app - (cd $(dirname "$MAIN_BUILD_DIR") && zip -r "../../PackagedReleases/${DIR_NAME}-macOS.zip" "$DIR_NAME") - echo "Created packaged release from main directory: PackagedReleases/${DIR_NAME}-macOS.zip" + ZIP_BASE_NAME="${DIR_NAME}-macOS" else - # Package the entire Builds directory as a fallback - echo "No main directory found, packaging everything" - zip -r "PackagedReleases/LuckyRobots-macOS.zip" Builds - echo "Created fallback package: PackagedReleases/LuckyRobots-macOS.zip" + echo "No build directory found, using entire Builds folder" + BUILD_DIR="." + ZIP_BASE_NAME="LuckyRobots-macOS" fi fi - echo "Packaged releases:" - ls -la PackagedReleases/ + # Create chunks directory if it doesn't exist + CHUNK_DIR="PackagedReleases/chunks" + mkdir -p "$CHUNK_DIR" + + echo "Splitting build into 1.8GB chunks..." + + if [ -n "$BUILD_DIR" ]; then + # Create a chunked zip archive directly + (cd "$BUILD_DIR" && tar -c * | split -b 1800m - "$CHUNK_DIR/${ZIP_BASE_NAME}-part") + echo "Created chunked build files" + + # Create a checksum file + (cd "$CHUNK_DIR" && md5 ${ZIP_BASE_NAME}-part* > ${ZIP_BASE_NAME}-checksums.md5) + + # Create download scripts for different platforms + + # Windows batch script + cat > "PackagedReleases/download-mac-build.bat" << 'EOL' + @echo off + echo LuckyRobots macOS Build Downloader + echo ================================== + echo. + + REM Get the release tag from command line or prompt user + set TAG=%1 + if "%TAG%"=="" ( + echo Enter the release tag (e.g. v1.0.0): + set /p TAG= + ) + + echo Downloading macOS build parts for %TAG%... + echo. + + REM Create directory for downloads + mkdir macos-build 2>nul + cd macos-build + + REM Get the list of files to download + curl -s -L -O https://luckyrobots.com/luckyrobots/luckyworld/releases/download/%TAG%/LuckyRobots-macOS-checksums.md5 + + REM Extract filenames from the checksums file + for /f "tokens=2 delims= " %%f in (LuckyRobots-macOS-checksums.md5) do ( + echo Downloading %%f... + curl -L -O https://luckyrobots.com/luckyrobots/luckyworld/releases/download/%TAG%/%%f + ) + + echo All parts downloaded. Combining... + copy /b LuckyRobots-macOS-part* LuckyRobots-macOS.tar + + echo Extracting files... + tar -xf LuckyRobots-macOS.tar + + echo Done! macOS build downloaded and extracted. + cd .. + EOL + + # macOS/Linux bash script + cat > "PackagedReleases/download-mac-build.sh" << 'EOL' + #!/bin/bash + + echo "LuckyRobots macOS Build Downloader" + echo "==================================" + echo + + # Get the release tag from command line or prompt user + TAG=$1 + if [ -z "$TAG" ]; then + echo "Enter the release tag (e.g. v1.0.0):" + read TAG + fi + + echo "Downloading macOS build parts for $TAG..." + echo + + # Create directory for downloads + mkdir -p macos-build + cd macos-build + + # Get the list of files to download + curl -s -L -O "https://luckyrobots.com/luckyrobots/luckyworld/releases/download/$TAG/LuckyRobots-macOS-checksums.md5" + + # Extract filenames from the checksums file + for file in $(awk '{print $2}' LuckyRobots-macOS-checksums.md5); do + echo "Downloading $file..." + curl -L -O "https://luckyrobots.com/luckyrobots/luckyworld/releases/download/$TAG/$file" + done + + echo "All parts downloaded. Combining..." + cat LuckyRobots-macOS-part* > LuckyRobots-macOS.tar + + echo "Extracting files..." + tar -xf LuckyRobots-macOS.tar + + echo "Done! macOS build downloaded and extracted." + cd .. + EOL + + # Make the shell script executable + chmod +x "PackagedReleases/download-mac-build.sh" + + # Create a simple README + cat > "PackagedReleases/README-macOS.txt" << 'EOL' + # LuckyRobots macOS Build + + This build is split into multiple files due to size limitations. + + ## Easy Download + + For the easiest download experience: + + - Windows: Download and run download-mac-build.bat + - macOS/Linux: Download and run download-mac-build.sh + + Both scripts will automatically download all needed files, combine them, + and extract the build to a folder called "macos-build". + + ## Manual Download + + If you prefer to download manually: + + 1. Download all the part files (LuckyRobots-macOS-part*) + 2. Combine them: + - Windows: copy /b LuckyRobots-macOS-part* LuckyRobots-macOS.tar + - macOS/Linux: cat LuckyRobots-macOS-part* > LuckyRobots-macOS.tar + 3. Extract the tar file: + - Using tar -xf LuckyRobots-macOS.tar + + Enjoy playing! + EOL + + # Zip the instructions and scripts for easy download + zip -j "PackagedReleases/LuckyRobots-macOS-downloader.zip" \ + "PackagedReleases/README-macOS.txt" \ + "PackagedReleases/download-mac-build.bat" \ + "PackagedReleases/download-mac-build.sh" + + # Also copy the checksum file up one level for the downloader + cp "$CHUNK_DIR/${ZIP_BASE_NAME}-checksums.md5" "PackagedReleases/${ZIP_BASE_NAME}-checksums.md5" + + # List the files + echo "Created files:" + ls -la "$CHUNK_DIR" + echo "Created downloader package:" + ls -la "PackagedReleases" + else + echo "Error: Could not find any build directory to package" + exit 1 + fi - name: Create Gitea Release if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' @@ -242,8 +381,18 @@ jobs: body: | ## Automated release from CI build #${{ github.run_number }} - This release includes builds for: - - macOS + ### macOS Build Instructions + + **Quick setup:** Download the LuckyRobots-macOS-downloader.zip file first! + This contains scripts that will automatically download and extract all parts. + + For manual setup: + 1. Download all part files + 2. Combine them using: `cat LuckyRobots-macOS-part* > LuckyRobots-macOS.tar` + 3. Extract with: `tar -xf LuckyRobots-macOS.tar` Built from commit: ${{ github.sha }} - files: PackagedReleases/*.zip + files: |- + PackagedReleases/*.zip + PackagedReleases/*.md5 + PackagedReleases/chunks/*