diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index 0b69373..e8711a1 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -3,7 +3,7 @@ name: Build Game # Build pipeline for creating game executables across multiple platforms # # Features: -# - Manual trigger with platform selection +# - Manual trigger with individual platform checkboxes # - Tag-based automatic builds for releases # - Multi-platform builds (Windows, Linux, macOS, Android) # - Artifact storage for one week @@ -13,11 +13,26 @@ on: # Manual trigger with platform selection workflow_dispatch: inputs: - platforms: - description: 'Platforms to build (comma-separated: windows,linux,macos,android)' - required: true - default: 'windows,linux' - type: string + build_windows: + description: 'Build for Windows' + required: false + default: true + type: boolean + build_linux: + description: 'Build for Linux' + required: false + default: true + type: boolean + build_macos: + description: 'Build for macOS' + required: false + default: false + type: boolean + build_android: + description: 'Build for Android' + required: false + default: false + type: boolean build_type: description: 'Build type' required: true @@ -64,7 +79,23 @@ jobs: run: | # Determine platforms to build if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then - platforms="${{ github.event.inputs.platforms }}" + # Build platforms array from individual checkboxes + platforms="" + if [[ "${{ github.event.inputs.build_windows }}" == "true" ]]; then + platforms="${platforms}windows," + fi + if [[ "${{ github.event.inputs.build_linux }}" == "true" ]]; then + platforms="${platforms}linux," + fi + if [[ "${{ github.event.inputs.build_macos }}" == "true" ]]; then + platforms="${platforms}macos," + fi + if [[ "${{ github.event.inputs.build_android }}" == "true" ]]; then + platforms="${platforms}android," + fi + # Remove trailing comma + platforms="${platforms%,}" + build_type="${{ github.event.inputs.build_type }}" version_override="${{ github.event.inputs.version_override }}" else @@ -101,11 +132,50 @@ jobs: echo " Version: ${version}" echo " Artifact: ${artifact_name}" + # Setup export templates (shared across all platform builds) + setup-templates: + name: Setup Export Templates + runs-on: ubuntu-latest + needs: prepare + + steps: + - name: Cache export templates + id: cache-templates + uses: actions/cache@v4 + with: + path: ~/.local/share/godot/export_templates + key: godot-templates-${{ env.GODOT_VERSION }} + restore-keys: | + godot-templates- + + - name: Setup Godot + if: steps.cache-templates.outputs.cache-hit != 'true' + uses: chickensoft-games/setup-godot@v1 + with: + version: ${{ env.GODOT_VERSION }} + use-dotnet: false + + - name: Install export templates + if: steps.cache-templates.outputs.cache-hit != 'true' + run: | + echo "📦 Installing Godot export templates..." + mkdir -p ~/.local/share/godot/export_templates/${{ env.GODOT_VERSION }}.stable + wget -q https://github.com/godotengine/godot/releases/download/${{ env.GODOT_VERSION }}-stable/Godot_v${{ env.GODOT_VERSION }}-stable_export_templates.tpz + unzip -q Godot_v${{ env.GODOT_VERSION }}-stable_export_templates.tpz + mv templates/* ~/.local/share/godot/export_templates/${{ env.GODOT_VERSION }}.stable/ + echo "✅ Export templates installed successfully" + ls -la ~/.local/share/godot/export_templates/${{ env.GODOT_VERSION }}.stable/ + + - name: Verify templates cache + run: | + echo "🔍 Verifying export templates are available:" + ls -la ~/.local/share/godot/export_templates/${{ env.GODOT_VERSION }}.stable/ + # Windows build job build-windows: name: Build Windows runs-on: ubuntu-latest - needs: prepare + needs: [prepare, setup-templates] if: contains(needs.prepare.outputs.platforms, 'windows') steps: @@ -118,15 +188,13 @@ jobs: version: ${{ env.GODOT_VERSION }} use-dotnet: false - - name: Install export templates - run: | - echo "📦 Installing Godot export templates..." - mkdir -p ~/.local/share/godot/export_templates/${{ env.GODOT_VERSION }}.stable - wget -q https://github.com/godotengine/godot/releases/download/${{ env.GODOT_VERSION }}-stable/Godot_v${{ env.GODOT_VERSION }}-stable_export_templates.tpz - unzip -q Godot_v${{ env.GODOT_VERSION }}-stable_export_templates.tpz - mv templates/* ~/.local/share/godot/export_templates/${{ env.GODOT_VERSION }}.stable/ - echo "✅ Export templates installed successfully" - ls -la ~/.local/share/godot/export_templates/${{ env.GODOT_VERSION }}.stable/ + - name: Restore export templates cache + uses: actions/cache@v4 + with: + path: ~/.local/share/godot/export_templates + key: godot-templates-${{ env.GODOT_VERSION }} + restore-keys: | + godot-templates- - name: Create build directory run: mkdir -p ${{ env.BUILD_DIR }} @@ -164,7 +232,7 @@ jobs: build-linux: name: Build Linux runs-on: ubuntu-latest - needs: prepare + needs: [prepare, setup-templates] if: contains(needs.prepare.outputs.platforms, 'linux') steps: @@ -177,15 +245,13 @@ jobs: version: ${{ env.GODOT_VERSION }} use-dotnet: false - - name: Install export templates - run: | - echo "📦 Installing Godot export templates..." - mkdir -p ~/.local/share/godot/export_templates/${{ env.GODOT_VERSION }}.stable - wget -q https://github.com/godotengine/godot/releases/download/${{ env.GODOT_VERSION }}-stable/Godot_v${{ env.GODOT_VERSION }}-stable_export_templates.tpz - unzip -q Godot_v${{ env.GODOT_VERSION }}-stable_export_templates.tpz - mv templates/* ~/.local/share/godot/export_templates/${{ env.GODOT_VERSION }}.stable/ - echo "✅ Export templates installed successfully" - ls -la ~/.local/share/godot/export_templates/${{ env.GODOT_VERSION }}.stable/ + - name: Restore export templates cache + uses: actions/cache@v4 + with: + path: ~/.local/share/godot/export_templates + key: godot-templates-${{ env.GODOT_VERSION }} + restore-keys: | + godot-templates- - name: Create build directory run: mkdir -p ${{ env.BUILD_DIR }} @@ -226,7 +292,7 @@ jobs: build-macos: name: Build macOS runs-on: ubuntu-latest - needs: prepare + needs: [prepare, setup-templates] if: contains(needs.prepare.outputs.platforms, 'macos') steps: @@ -239,15 +305,13 @@ jobs: version: ${{ env.GODOT_VERSION }} use-dotnet: false - - name: Install export templates - run: | - echo "📦 Installing Godot export templates..." - mkdir -p ~/.local/share/godot/export_templates/${{ env.GODOT_VERSION }}.stable - wget -q https://github.com/godotengine/godot/releases/download/${{ env.GODOT_VERSION }}-stable/Godot_v${{ env.GODOT_VERSION }}-stable_export_templates.tpz - unzip -q Godot_v${{ env.GODOT_VERSION }}-stable_export_templates.tpz - mv templates/* ~/.local/share/godot/export_templates/${{ env.GODOT_VERSION }}.stable/ - echo "✅ Export templates installed successfully" - ls -la ~/.local/share/godot/export_templates/${{ env.GODOT_VERSION }}.stable/ + - name: Restore export templates cache + uses: actions/cache@v4 + with: + path: ~/.local/share/godot/export_templates + key: godot-templates-${{ env.GODOT_VERSION }} + restore-keys: | + godot-templates- - name: Create build directory run: mkdir -p ${{ env.BUILD_DIR }} @@ -285,7 +349,7 @@ jobs: build-android: name: Build Android runs-on: ubuntu-latest - needs: prepare + needs: [prepare, setup-templates] if: contains(needs.prepare.outputs.platforms, 'android') steps: @@ -310,14 +374,13 @@ jobs: version: ${{ env.GODOT_VERSION }} use-dotnet: false - - name: Install export templates - run: | - echo "📦 Installing Godot export templates..." - mkdir -p ~/.local/share/godot/export_templates/${{ env.GODOT_VERSION }}.stable - wget -q https://github.com/godotengine/godot/releases/download/${{ env.GODOT_VERSION }}-stable/Godot_v${{ env.GODOT_VERSION }}-stable_export_templates.tpz - unzip -q Godot_v${{ env.GODOT_VERSION }}-stable_export_templates.tpz - mv templates/* ~/.local/share/godot/export_templates/${{ env.GODOT_VERSION }}.stable/ - echo "✅ Export templates installed successfully" + - name: Restore export templates cache + uses: actions/cache@v4 + with: + path: ~/.local/share/godot/export_templates + key: godot-templates-${{ env.GODOT_VERSION }} + restore-keys: | + godot-templates- - name: Create build directory run: mkdir -p ${{ env.BUILD_DIR }} @@ -363,7 +426,7 @@ jobs: summary: name: Build Summary runs-on: ubuntu-latest - needs: [prepare, build-windows, build-linux, build-macos, build-android] + needs: [prepare, setup-templates, build-windows, build-linux, build-macos, build-android] if: always() steps: