add build cache

use checkboxes
This commit is contained in:
2025-09-30 00:28:17 +04:00
parent 501cad6175
commit 9150622e74

View File

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