From 5d323c79d7695cf43537e91c81e7229ad79be315 Mon Sep 17 00:00:00 2001
From: Goran Lazarevski <goranmrd@gmail.com>
Date: Tue, 1 Apr 2025 13:53:04 +0200
Subject: [PATCH] Split build to chunks

---
 .gitea/workflows/unreal-build.yml | 130 +++++++++++++++++++++++++++---
 1 file changed, 119 insertions(+), 11 deletions(-)

diff --git a/.gitea/workflows/unreal-build.yml b/.gitea/workflows/unreal-build.yml
index 0ea0dd63..a1b8ac9d 100644
--- a/.gitea/workflows/unreal-build.yml
+++ b/.gitea/workflows/unreal-build.yml
@@ -58,6 +58,22 @@ jobs:
           echo "=== Packaged releases ==="
           ls -la PackagedReleases/
       
+      - name: Upload Windows Build Artifact
+        uses: actions/upload-artifact@v3
+        if: success() && hashFiles('PackagedReleases/LuckyRobots-Windows.zip') != ''
+        with:
+          name: LuckyRobots-Windows
+          path: PackagedReleases/LuckyRobots-Windows.zip
+          retention-days: 14
+      
+      - name: Upload Linux Build Artifact
+        uses: actions/upload-artifact@v3
+        if: success() && hashFiles('PackagedReleases/LuckyRobots-Linux.zip') != ''
+        with:
+          name: LuckyRobots-Linux
+          path: PackagedReleases/LuckyRobots-Linux.zip
+          retention-days: 14
+      
       - name: Create Tag
         if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop'
         run: |
@@ -117,21 +133,96 @@ jobs:
           fi
           echo "RELEASE_TAG=$TAG" >> $GITHUB_ENV
       
+      - name: Create Build Info
+        run: |
+          # Create a build info JSON file
+          echo '{
+            "version": "${{ env.RELEASE_TAG }}",
+            "buildNumber": "${{ github.run_number }}",
+            "commit": "${{ github.sha }}",
+            "branch": "${{ github.ref_name }}",
+            "buildDate": "'$(date -u +"%Y-%m-%dT%H:%M:%SZ")'",
+            "artifacts": {
+              "windows": "https://luckyrobots.com/luckyrobots/luckyworld/actions/runs/${{ github.run_id }}/artifacts/download/LuckyRobots-Windows",
+              "linux": "https://luckyrobots.com/luckyrobots/luckyworld/actions/runs/${{ github.run_id }}/artifacts/download/LuckyRobots-Linux"
+            }
+          }' > PackagedReleases/build-info.json
+          
+          # Create a simple HTML download page
+          echo '<!DOCTYPE html>
+          <html lang="en">
+          <head>
+            <meta charset="UTF-8">
+            <meta name="viewport" content="width=device-width, initial-scale=1.0">
+            <title>LuckyRobots ${{ env.RELEASE_TAG }} Downloads</title>
+            <style>
+              body { font-family: Arial, sans-serif; max-width: 800px; margin: 0 auto; padding: 20px; }
+              h1 { color: #333; }
+              .download-btn { 
+                display: inline-block; 
+                background-color: #4CAF50; 
+                color: white; 
+                padding: 10px 20px; 
+                text-decoration: none; 
+                border-radius: 4px; 
+                margin: 10px 5px;
+              }
+              .download-btn:hover { background-color: #45a049; }
+              .platform { margin-bottom: 30px; }
+            </style>
+          </head>
+          <body>
+            <h1>LuckyRobots Game - ${{ env.RELEASE_TAG }}</h1>
+            <p>Build #${{ github.run_number }} - Built from commit: ${{ github.sha }}</p>
+            
+            <div class="platform">
+              <h2>Windows</h2>
+              <p><a href="https://luckyrobots.com/luckyrobots/luckyworld/actions/runs/${{ github.run_id }}/artifacts/download/LuckyRobots-Windows" class="download-btn">Download Windows Build</a></p>
+            </div>
+            
+            <div class="platform">
+              <h2>Linux</h2>
+              <p><a href="https://luckyrobots.com/luckyrobots/luckyworld/actions/runs/${{ github.run_id }}/artifacts/download/LuckyRobots-Linux" class="download-btn">Download Linux Build</a></p>
+            </div>
+            
+            <div class="platform">
+              <h2>macOS</h2>
+              <p><a href="https://luckyrobots.com/luckyrobots/luckyworld/actions/runs/${{ github.run_id }}/artifacts/download/LuckyRobots-macOS" class="download-btn">Download macOS Build</a></p>
+            </div>
+            
+            <footer>
+              <p>Generated on '$(date -u +"%Y-%m-%d %H:%M:%S UTC")'</p>
+            </footer>
+          </body>
+          </html>' > PackagedReleases/downloads.html
+      
       - name: Create Release
         uses: https://gitea.com/actions/gitea-release-action@main
         with:
           files: |-
-            PackagedReleases/*.zip
+            PackagedReleases/build-info.json
+            PackagedReleases/downloads.html
           token: '${{ secrets.GITEA_TOKEN }}'
           title: 'Release ${{ env.RELEASE_TAG }}'
           body: |
-            ## Automated release from CI build #${{ github.run_number }}
+            ## LuckyRobots Game Release ${{ env.RELEASE_TAG }}
             
-            This release includes builds for:
-            - Windows
-            - Linux
+            ### Download Links
             
-            Built from commit: ${{ github.sha }}
+            Download builds from our CI artifacts:
+            
+            - [Windows Build](https://luckyrobots.com/luckyrobots/luckyworld/actions/runs/${{ github.run_id }}/artifacts/download/LuckyRobots-Windows)
+            - [Linux Build](https://luckyrobots.com/luckyrobots/luckyworld/actions/runs/${{ github.run_id }}/artifacts/download/LuckyRobots-Linux)
+            - [macOS Build](https://luckyrobots.com/luckyrobots/luckyworld/actions/runs/${{ github.run_id }}/artifacts/download/LuckyRobots-macOS)
+            
+            Or visit our [download page](https://luckyrobots.com/luckyrobots/luckyworld/releases/download/${{ env.RELEASE_TAG }}/downloads.html).
+            
+            ### Build Information
+            
+            - Build Number: #${{ github.run_number }}
+            - Commit: ${{ github.sha }}
+            - Branch: ${{ github.ref_name }}
+            - Build Date: $(date -u +"%Y-%m-%d %H:%M:%S UTC")
           prerelease: ${{ github.ref != 'refs/heads/main' }}
           tag_name: '${{ env.RELEASE_TAG }}'
           
@@ -232,18 +323,35 @@ jobs:
           echo "Packaged releases:"
           ls -la PackagedReleases/
       
+      - name: Upload macOS Build Artifact
+        uses: actions/upload-artifact@v3
+        if: success()
+        with:
+          name: LuckyRobots-macOS
+          path: PackagedReleases/*-macOS.zip
+          retention-days: 14
+      
+      - name: Create Release Note
+        run: |
+          echo "## macOS Build Completed" > release-note.md
+          echo "" >> release-note.md
+          echo "macOS build is available as an artifact." >> release-note.md
+          echo "" >> release-note.md
+          echo "Download from: [macOS Build](https://luckyrobots.com/luckyrobots/luckyworld/actions/runs/${{ github.run_id }}/artifacts/download/LuckyRobots-macOS)" >> release-note.md
+          
       - name: Create Gitea Release
         if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop'
         uses: https://gitea.com/actions/gitea-release-action@main
         with:
           token: ${{ secrets.GITEATOKEN }}
           tag_name: ${{ env.RELEASE_TAG }}
-          title: "Release ${{ env.RELEASE_TAG }}"
+          title: "Release ${{ env.RELEASE_TAG }} - macOS"
           body: |
-            ## Automated release from CI build #${{ github.run_number }}
+            ## macOS Build Available as Artifact
             
-            This release includes builds for:
-            - macOS
+            The macOS build is available as an artifact due to its large file size.
+            
+            [Download macOS Build](https://luckyrobots.com/luckyrobots/luckyworld/actions/runs/${{ github.run_id }}/artifacts/download/LuckyRobots-macOS)
             
             Built from commit: ${{ github.sha }}
-          files: PackagedReleases/*.zip
+          files: release-note.md
\ No newline at end of file