Compare commits

2 Commits

Author SHA1 Message Date
35151cecf1 android sdk (2nd try) 2025-10-01 08:48:48 +04:00
dde7b98ed2 android sdk prepare 2025-09-30 23:44:06 +04:00
3 changed files with 198 additions and 46 deletions

View File

@@ -4,10 +4,13 @@ name: Build Game
#
# Features:
# - Manual trigger with individual platform checkboxes
# - Configurable version override (defaults to auto-generated)
# - Configurable tool versions (Godot, Java, Android API, etc.)
# - Flexible runner OS selection
# - Tag-based automatic builds for releases
# - Multi-platform builds (Windows, Linux, macOS, Android)
# - Artifact storage for one week
# - Configurable build options
# - Comprehensive build configuration options
on:
# Manual trigger with platform selection
@@ -33,6 +36,11 @@ on:
required: false
default: false
type: boolean
version:
description: 'Version (leave empty for auto-generated)'
required: false
default: ''
type: string
build_type:
description: 'Build type'
required: true
@@ -41,9 +49,25 @@ on:
options:
- release
- debug
version_override:
description: 'Override version (optional)'
godot_version:
description: 'Godot version (leave empty for default)'
required: false
default: ''
type: string
runner_os:
description: 'Runner OS (leave empty for default ubuntu-latest)'
required: false
default: ''
type: string
java_version:
description: 'Java version (leave empty for default)'
required: false
default: ''
type: string
android_api_level:
description: 'Android API level (leave empty for default)'
required: false
default: ''
type: string
# Automatic trigger on git tags (for releases)
@@ -53,15 +77,39 @@ on:
- 'release-*' # Release tags
env:
# Core Configuration
GODOT_VERSION: "4.4.1"
PROJECT_NAME: "Skelly"
BUILD_DIR: "builds"
DEFAULT_VERSION: "1.0.0-dev"
# GitHub Actions Versions
ACTIONS_CHECKOUT_VERSION: "v4"
ACTIONS_CACHE_VERSION: "v4"
ACTIONS_UPLOAD_ARTIFACT_VERSION: "v3"
ACTIONS_SETUP_JAVA_VERSION: "v4"
# Third-party Actions Versions
CHICKENSOFT_SETUP_GODOT_VERSION: "v1"
ANDROID_ACTIONS_SETUP_ANDROID_VERSION: "v3"
# Runner Configuration
RUNNER_OS: "ubuntu-latest"
# Java Configuration
JAVA_DISTRIBUTION: "temurin"
JAVA_VERSION: "17"
# Android Configuration
ANDROID_API_LEVEL: "33"
ANDROID_BUILD_TOOLS_VERSION: "33.0.0"
ANDROID_CMDLINE_TOOLS_VERSION: "latest"
jobs:
# Preparation job - determines build configuration
prepare:
name: Prepare Build
runs-on: ubuntu-latest
runs-on: ${{ env.RUNNER_OS }}
outputs:
platforms: ${{ steps.config.outputs.platforms }}
build_type: ${{ steps.config.outputs.build_type }}
@@ -70,13 +118,35 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@${{ env.ACTIONS_CHECKOUT_VERSION }}
with:
fetch-depth: 0
- name: Configure build parameters
id: config
run: |
# Override environment variables with user inputs if provided
if [[ -n "${{ github.event.inputs.godot_version }}" ]]; then
echo "GODOT_VERSION=${{ github.event.inputs.godot_version }}" >> $GITHUB_ENV
echo "🔧 Using custom Godot version: ${{ github.event.inputs.godot_version }}"
fi
if [[ -n "${{ github.event.inputs.runner_os }}" ]]; then
echo "RUNNER_OS=${{ github.event.inputs.runner_os }}" >> $GITHUB_ENV
echo "🔧 Using custom runner OS: ${{ github.event.inputs.runner_os }}"
fi
if [[ -n "${{ github.event.inputs.java_version }}" ]]; then
echo "JAVA_VERSION=${{ github.event.inputs.java_version }}" >> $GITHUB_ENV
echo "🔧 Using custom Java version: ${{ github.event.inputs.java_version }}"
fi
if [[ -n "${{ github.event.inputs.android_api_level }}" ]]; then
echo "ANDROID_API_LEVEL=${{ github.event.inputs.android_api_level }}" >> $GITHUB_ENV
echo "ANDROID_BUILD_TOOLS_VERSION=${{ github.event.inputs.android_api_level }}.0.0" >> $GITHUB_ENV
echo "🔧 Using custom Android API level: ${{ github.event.inputs.android_api_level }}"
fi
# Determine platforms to build
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
# Build platforms array from individual checkboxes
@@ -97,25 +167,37 @@ jobs:
platforms="${platforms%,}"
build_type="${{ github.event.inputs.build_type }}"
version_override="${{ github.event.inputs.version_override }}"
user_version="${{ github.event.inputs.version }}"
else
# Tag-triggered build - build all platforms
platforms="windows,linux,macos,android"
build_type="release"
version_override=""
user_version=""
fi
# Determine version
if [[ -n "$version_override" ]]; then
version="$version_override"
# Determine version with improved logic
if [[ -n "$user_version" ]]; then
# User provided explicit version
version="$user_version"
echo "🏷️ Using user-specified version: $version"
elif [[ "${{ github.ref_type }}" == "tag" ]]; then
# Tag-triggered build - use tag name
version="${{ github.ref_name }}"
else
# Generate version from git info
echo "🏷️ Using git tag version: $version"
elif [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
# Manual dispatch without version - use default + git info
commit_short=$(git rev-parse --short HEAD)
branch_name="${{ github.ref_name }}"
timestamp=$(date +%Y%m%d-%H%M)
version="${branch_name}-${commit_short}-${timestamp}"
version="${{ env.DEFAULT_VERSION }}-${branch_name}-${commit_short}-${timestamp}"
echo "🏷️ Using auto-generated version: $version"
else
# Fallback for other triggers
commit_short=$(git rev-parse --short HEAD)
branch_name="${{ github.ref_name }}"
timestamp=$(date +%Y%m%d-%H%M)
version="${{ env.DEFAULT_VERSION }}-${branch_name}-${commit_short}-${timestamp}"
echo "🏷️ Using fallback version: $version"
fi
# Create artifact name
@@ -131,17 +213,24 @@ jobs:
echo " Build Type: ${build_type}"
echo " Version: ${version}"
echo " Artifact: ${artifact_name}"
echo ""
echo "🔧 Tool Versions:"
echo " Godot: ${GODOT_VERSION}"
echo " Runner OS: ${RUNNER_OS}"
echo " Java: ${JAVA_VERSION}"
echo " Android API: ${ANDROID_API_LEVEL}"
echo " Android Build Tools: ${ANDROID_BUILD_TOOLS_VERSION}"
# Setup export templates (shared across all platform builds)
setup-templates:
name: Setup Export Templates
runs-on: ubuntu-latest
runs-on: ${{ env.RUNNER_OS }}
needs: prepare
steps:
- name: Cache export templates
id: cache-templates
uses: actions/cache@v4
uses: actions/cache@${{ env.ACTIONS_CACHE_VERSION }}
with:
path: ~/.local/share/godot/export_templates
key: godot-templates-${{ env.GODOT_VERSION }}
@@ -150,7 +239,7 @@ jobs:
- name: Setup Godot
if: steps.cache-templates.outputs.cache-hit != 'true'
uses: chickensoft-games/setup-godot@v1
uses: chickensoft-games/setup-godot@${{ env.CHICKENSOFT_SETUP_GODOT_VERSION }}
with:
version: ${{ env.GODOT_VERSION }}
use-dotnet: false
@@ -174,22 +263,22 @@ jobs:
# Windows build job
build-windows:
name: Build Windows
runs-on: ubuntu-latest
runs-on: ${{ env.RUNNER_OS }}
needs: [prepare, setup-templates]
if: contains(needs.prepare.outputs.platforms, 'windows')
steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@${{ env.ACTIONS_CHECKOUT_VERSION }}
- name: Setup Godot
uses: chickensoft-games/setup-godot@v1
uses: chickensoft-games/setup-godot@${{ env.CHICKENSOFT_SETUP_GODOT_VERSION }}
with:
version: ${{ env.GODOT_VERSION }}
use-dotnet: false
- name: Restore export templates cache
uses: actions/cache@v4
uses: actions/cache@${{ env.ACTIONS_CACHE_VERSION }}
with:
path: ~/.local/share/godot/export_templates
key: godot-templates-${{ env.GODOT_VERSION }}
@@ -221,7 +310,7 @@ jobs:
fi
- name: Upload Windows build
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@${{ env.ACTIONS_UPLOAD_ARTIFACT_VERSION }}
with:
name: ${{ needs.prepare.outputs.artifact_name }}-windows
path: ${{ env.BUILD_DIR }}/skelly-windows-${{ needs.prepare.outputs.version }}.exe
@@ -231,22 +320,22 @@ jobs:
# Linux build job
build-linux:
name: Build Linux
runs-on: ubuntu-latest
runs-on: ${{ env.RUNNER_OS }}
needs: [prepare, setup-templates]
if: contains(needs.prepare.outputs.platforms, 'linux')
steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@${{ env.ACTIONS_CHECKOUT_VERSION }}
- name: Setup Godot
uses: chickensoft-games/setup-godot@v1
uses: chickensoft-games/setup-godot@${{ env.CHICKENSOFT_SETUP_GODOT_VERSION }}
with:
version: ${{ env.GODOT_VERSION }}
use-dotnet: false
- name: Restore export templates cache
uses: actions/cache@v4
uses: actions/cache@${{ env.ACTIONS_CACHE_VERSION }}
with:
path: ~/.local/share/godot/export_templates
key: godot-templates-${{ env.GODOT_VERSION }}
@@ -281,7 +370,7 @@ jobs:
fi
- name: Upload Linux build
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@${{ env.ACTIONS_UPLOAD_ARTIFACT_VERSION }}
with:
name: ${{ needs.prepare.outputs.artifact_name }}-linux
path: ${{ env.BUILD_DIR }}/skelly-linux-${{ needs.prepare.outputs.version }}.x86_64
@@ -291,22 +380,22 @@ jobs:
# macOS build job
build-macos:
name: Build macOS
runs-on: ubuntu-latest
runs-on: ${{ env.RUNNER_OS }}
needs: [prepare, setup-templates]
if: contains(needs.prepare.outputs.platforms, 'macos')
steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@${{ env.ACTIONS_CHECKOUT_VERSION }}
- name: Setup Godot
uses: chickensoft-games/setup-godot@v1
uses: chickensoft-games/setup-godot@${{ env.CHICKENSOFT_SETUP_GODOT_VERSION }}
with:
version: ${{ env.GODOT_VERSION }}
use-dotnet: false
- name: Restore export templates cache
uses: actions/cache@v4
uses: actions/cache@${{ env.ACTIONS_CACHE_VERSION }}
with:
path: ~/.local/share/godot/export_templates
key: godot-templates-${{ env.GODOT_VERSION }}
@@ -338,7 +427,7 @@ jobs:
fi
- name: Upload macOS build
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@${{ env.ACTIONS_UPLOAD_ARTIFACT_VERSION }}
with:
name: ${{ needs.prepare.outputs.artifact_name }}-macos
path: ${{ env.BUILD_DIR }}/skelly-macos-${{ needs.prepare.outputs.version }}.zip
@@ -348,34 +437,93 @@ jobs:
# Android build job
build-android:
name: Build Android
runs-on: ubuntu-latest
runs-on: ${{ env.RUNNER_OS }}
needs: [prepare, setup-templates]
if: contains(needs.prepare.outputs.platforms, 'android')
steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@${{ env.ACTIONS_CHECKOUT_VERSION }}
- name: Setup Java
uses: actions/setup-java@v4
uses: actions/setup-java@${{ env.ACTIONS_SETUP_JAVA_VERSION }}
with:
distribution: 'temurin'
java-version: '17'
distribution: ${{ env.JAVA_DISTRIBUTION }}
java-version: ${{ env.JAVA_VERSION }}
- name: Setup Android SDK
uses: android-actions/setup-android@v3
uses: android-actions/setup-android@${{ env.ANDROID_ACTIONS_SETUP_ANDROID_VERSION }}
with:
api-level: 33
build-tools: 33.0.0
api-level: ${{ env.ANDROID_API_LEVEL }}
build-tools: ${{ env.ANDROID_BUILD_TOOLS_VERSION }}
- name: Install Android Build Tools
run: |
echo "🔧 Installing Android Build Tools..."
# Set Android environment variables
export ANDROID_HOME=${ANDROID_SDK_ROOT}
echo "ANDROID_HOME=${ANDROID_SDK_ROOT}" >> $GITHUB_ENV
echo "ANDROID_SDK_ROOT=${ANDROID_SDK_ROOT}" >> $GITHUB_ENV
# Install build-tools using sdkmanager
yes | ${ANDROID_SDK_ROOT}/cmdline-tools/${{ env.ANDROID_CMDLINE_TOOLS_VERSION }}/bin/sdkmanager --licenses || true
${ANDROID_SDK_ROOT}/cmdline-tools/${{ env.ANDROID_CMDLINE_TOOLS_VERSION }}/bin/sdkmanager "build-tools;${{ env.ANDROID_BUILD_TOOLS_VERSION }}"
${ANDROID_SDK_ROOT}/cmdline-tools/${{ env.ANDROID_CMDLINE_TOOLS_VERSION }}/bin/sdkmanager "platforms;android-${{ env.ANDROID_API_LEVEL }}"
- name: Verify Android SDK Configuration
run: |
echo "📱 Verifying Android SDK setup..."
echo "📱 Using API Level: ${{ env.ANDROID_API_LEVEL }}"
echo "📱 Using Build Tools: ${{ env.ANDROID_BUILD_TOOLS_VERSION }}"
# Verify SDK installation
echo "📱 Android SDK Location: ${ANDROID_SDK_ROOT}"
ls -la ${ANDROID_SDK_ROOT}/
echo "📱 Build Tools:"
ls -la ${ANDROID_SDK_ROOT}/build-tools/
echo "📱 Platforms:"
ls -la ${ANDROID_SDK_ROOT}/platforms/ || echo "No platforms directory"
# Verify apksigner exists
if [ -f "${ANDROID_SDK_ROOT}/build-tools/${{ env.ANDROID_BUILD_TOOLS_VERSION }}/apksigner" ]; then
echo "✅ apksigner found at ${ANDROID_SDK_ROOT}/build-tools/${{ env.ANDROID_BUILD_TOOLS_VERSION }}/apksigner"
else
echo "❌ apksigner not found!"
exit 1
fi
- name: Setup Godot
uses: chickensoft-games/setup-godot@v1
uses: chickensoft-games/setup-godot@${{ env.CHICKENSOFT_SETUP_GODOT_VERSION }}
with:
version: ${{ env.GODOT_VERSION }}
use-dotnet: false
- name: Configure Godot for Android
run: |
echo "🎮 Configuring Godot for Android builds..."
# Create Godot config directory
mkdir -p ~/.config/godot
# Configure Android SDK path in Godot settings
cat > ~/.config/godot/editor_settings-4.4.tres << EOF
[gd_resource type="EditorSettings" format=3]
[resource]
export/android/android_sdk_path = "${ANDROID_SDK_ROOT}"
export/android/debug_keystore = ""
export/android/debug_keystore_user = "androiddebugkey"
export/android/debug_keystore_pass = "android"
export/android/force_system_user = false
export/android/timestamping_authority_url = ""
export/android/shutdown_adb_on_exit = true
EOF
echo "✅ Godot Android configuration complete"
- name: Restore export templates cache
uses: actions/cache@v4
uses: actions/cache@${{ env.ACTIONS_CACHE_VERSION }}
with:
path: ~/.local/share/godot/export_templates
key: godot-templates-${{ env.GODOT_VERSION }}
@@ -395,8 +543,11 @@ jobs:
run: |
echo "🏗️ Building Android APK..."
# Set ANDROID_HOME if not already set
export ANDROID_HOME=${ANDROID_HOME:-$ANDROID_SDK_ROOT}
# Verify Android environment
echo "📱 Android SDK: ${ANDROID_SDK_ROOT}"
echo "📱 API Level: ${{ env.ANDROID_API_LEVEL }}"
echo "📱 Build Tools Version: ${{ env.ANDROID_BUILD_TOOLS_VERSION }}"
echo "📱 Available Build Tools: $(ls ${ANDROID_SDK_ROOT}/build-tools/)"
godot --headless --verbose --export-${{ needs.prepare.outputs.build_type }} "Android" \
${{ env.BUILD_DIR }}/skelly-android-${{ needs.prepare.outputs.version }}.apk
@@ -415,7 +566,7 @@ jobs:
fi
- name: Upload Android build
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@${{ env.ACTIONS_UPLOAD_ARTIFACT_VERSION }}
with:
name: ${{ needs.prepare.outputs.artifact_name }}-android
path: ${{ env.BUILD_DIR }}/skelly-android-${{ needs.prepare.outputs.version }}.apk
@@ -425,7 +576,7 @@ jobs:
# Summary job - creates release summary
summary:
name: Build Summary
runs-on: ubuntu-latest
runs-on: ${{ env.RUNNER_OS }}
needs: [prepare, setup-templates, build-windows, build-linux, build-macos, build-android]
if: always()

View File

@@ -222,5 +222,6 @@ locale/translations=PackedStringArray("res://localization/MainStrings.en.transla
[rendering]
textures/canvas_textures/default_texture_filter=0
textures/vram_compression/import_etc2_astc=true
renderer/rendering_method="gl_compatibility"
renderer/rendering_method.mobile="gl_compatibility"

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=4 format=3 uid="uid://8c2w55brpwmm"]
[gd_scene load_steps=4 format=3 uid="uid://bvks3cu6s0ejv"]
[ext_resource type="Script" uid="uid://bs4veuda3h358" path="res://scenes/game/game.gd" id="1_uwrxv"]
[ext_resource type="PackedScene" path="res://scenes/ui/DebugToggle.tscn" id="3_debug"]