197 lines
7.9 KiB
YAML
197 lines
7.9 KiB
YAML
name: Export and release builds
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
release_name:
|
|
description: "Release name (e.g. 3.0.1)"
|
|
required: true
|
|
type: string
|
|
|
|
jobs:
|
|
export-and-release:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Read Godot version from project
|
|
id: version
|
|
run: |
|
|
python - <<'PY'
|
|
import re
|
|
import os
|
|
from pathlib import Path
|
|
|
|
text = Path("project.godot").read_text(encoding="utf-8")
|
|
features_match = re.search(r'config/features=PackedStringArray\(([^)]*)\)', text)
|
|
godot_version = "4.6"
|
|
if features_match:
|
|
versions = re.findall(r'"(\d+\.\d+)"', features_match.group(1))
|
|
if versions:
|
|
godot_version = versions[0]
|
|
# setup-godot requires full semver (major.minor.patch)
|
|
if godot_version.count(".") < 2:
|
|
godot_version += ".0"
|
|
output_path = os.environ["GITHUB_OUTPUT"]
|
|
with open(output_path, "a", encoding="utf-8") as fh:
|
|
fh.write(f"godot_version={godot_version}\n")
|
|
PY
|
|
|
|
- name: Download godot-sqlite binaries
|
|
run: |
|
|
curl -fsSL https://github.com/2shady4u/godot-sqlite/releases/download/v4.7/bin.zip -o /tmp/gdsqlite-bin.zip
|
|
unzip -o /tmp/gdsqlite-bin.zip -d addons/godot-sqlite/
|
|
|
|
- name: Setup Java
|
|
uses: actions/setup-java@v4
|
|
with:
|
|
distribution: temurin
|
|
java-version: 17
|
|
|
|
- name: Setup Android SDK
|
|
uses: android-actions/setup-android@v3
|
|
|
|
- name: Setup Godot
|
|
uses: chickensoft-games/setup-godot@v2
|
|
with:
|
|
version: ${{ steps.version.outputs.godot_version }}
|
|
use-dotnet: false
|
|
include-templates: true
|
|
|
|
- name: Generate debug keystore and configure Godot Android settings
|
|
run: |
|
|
KEYSTORE_PATH="$HOME/.android/debug.keystore"
|
|
mkdir -p "$(dirname "$KEYSTORE_PATH")"
|
|
keytool -genkeypair \
|
|
-keystore "$KEYSTORE_PATH" \
|
|
-alias androiddebugkey \
|
|
-keypass android \
|
|
-storepass android \
|
|
-dname "CN=Android Debug,O=Android,C=US" \
|
|
-keyalg RSA -keysize 2048 -validity 10000
|
|
mkdir -p ~/.config/godot
|
|
cat > ~/.config/godot/editor_settings-4.tres <<TRES
|
|
[gd_resource type="EditorSettings" format=3]
|
|
[resource]
|
|
export/android/java_sdk_path = "$JAVA_HOME"
|
|
export/android/android_sdk_path = "$ANDROID_HOME"
|
|
export/android/debug_keystore = "$KEYSTORE_PATH"
|
|
export/android/debug_keystore_user = "androiddebugkey"
|
|
export/android/debug_keystore_pass = "android"
|
|
TRES
|
|
python3 - "$KEYSTORE_PATH" <<'PY'
|
|
import sys, re
|
|
keystore_path = sys.argv[1]
|
|
with open("export_presets.cfg", "r") as f:
|
|
content = f.read()
|
|
# Inject keystore settings after each Android preset options header
|
|
keystore_block = (
|
|
f'keystore/release="{keystore_path}"\n'
|
|
f'keystore/release_user="androiddebugkey"\n'
|
|
f'keystore/release_password="android"\n'
|
|
)
|
|
# Find all [preset.N.options] sections for Android presets
|
|
# Insert keystore settings right after command_line/extra_args for each Android preset
|
|
content = re.sub(
|
|
r'(command_line/extra_args=""\n)',
|
|
r'\1' + keystore_block,
|
|
content
|
|
)
|
|
# Disable macOS code signing and notarization for CI (no Xcode/Apple ID)
|
|
content = content.replace("codesign/codesign=3", "codesign/codesign=0")
|
|
content = content.replace("notarization/notarization=2", "notarization/notarization=0")
|
|
content = content.replace("export/distribution_type=1", "export/distribution_type=0")
|
|
with open("export_presets.cfg", "w") as f:
|
|
f.write(content)
|
|
print("Patched export_presets.cfg: Android keystore + macOS signing disabled")
|
|
PY
|
|
|
|
- name: Import Godot project
|
|
run: godot --headless --import --quit
|
|
|
|
- name: Install Android build template
|
|
run: |
|
|
TEMPLATES_ROOT="$HOME/.local/share/godot/export_templates"
|
|
echo "Available export templates:"
|
|
ls -la "$TEMPLATES_ROOT/"
|
|
TEMPLATE_DIR=$(find "$TEMPLATES_ROOT" -maxdepth 1 -type d -name "4.*" | head -1)
|
|
echo "Using template dir: $TEMPLATE_DIR"
|
|
mkdir -p android/build
|
|
unzip -o "$TEMPLATE_DIR/android_source.zip" -d android/build/
|
|
GODOT_VERSION=$(basename "$TEMPLATE_DIR")
|
|
echo "$GODOT_VERSION" > android/.build_version
|
|
echo "$GODOT_VERSION" > android/build/.build_version
|
|
echo "Wrote .build_version in android/ and android/build/: $GODOT_VERSION"
|
|
# Prevent Godot from scanning and creating .import files in Android res/
|
|
touch android/build/res/.gdignore
|
|
|
|
- name: Export Android APK
|
|
run: |
|
|
mkdir -p build/Android
|
|
godot --headless --export-release "Android Kalulu APK" "build/Android/Kalulu.apk"
|
|
|
|
- name: Export Android APK 32 bits
|
|
run: godot --headless --export-release "Android Kalulu APK 32 bits" "build/Android/Kalulu-32bits.apk"
|
|
|
|
- name: Export Linux
|
|
run: |
|
|
mkdir -p build/Linux
|
|
godot --headless --export-release "Linux Kalulu" "build/Linux/Kalulu.x86_64"
|
|
|
|
- name: Export macOS
|
|
run: |
|
|
mkdir -p build/macOS
|
|
godot --headless --export-release "macOS Kalulu" "build/macOS/Kalulu.zip"
|
|
|
|
- name: Export Windows
|
|
run: |
|
|
mkdir -p build/Windows
|
|
godot --headless --export-release "Windows Kalulu" "build/Windows/Kalulu.exe"
|
|
|
|
- name: Package exports
|
|
env:
|
|
VERSION: ${{ inputs.release_name }}
|
|
run: |
|
|
cd build/Windows
|
|
zip -r "../Kalulu-Windows-${VERSION}.zip" .
|
|
cd ../Linux
|
|
zip -r "../Kalulu-Linux-${VERSION}.zip" .
|
|
cd ../macOS
|
|
mv Kalulu.zip "../Kalulu-macOS-${VERSION}.zip"
|
|
cd ../Android
|
|
zip -r "../Kalulu-Android-${VERSION}.zip" Kalulu.apk
|
|
zip -r "../Kalulu-Android-32bits-${VERSION}.zip" Kalulu-32bits.apk
|
|
|
|
- name: Create GitHub release
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
tag_name: v${{ inputs.release_name }}
|
|
name: v${{ inputs.release_name }}
|
|
body: |
|
|
## Instructions
|
|
Download the platform version you need and, if you wish, 1 language pack (you can also let the application download it and install it for you). All language packs can be found here: [Kalulu Languages](https://github.com/Excello-Recherche-Education/Kalulu-Languages/releases)
|
|
You need an internet access for the register / first login, but after that you can play offline if needed.
|
|
If you want to manually install the language pack, put it in this folder depending on your platform :
|
|
|
|
**🪟 Windows :**
|
|
C:\Users\\\<UserName\>\AppData\Roaming\Godot\app_userdata\Kalulu\language_resources\
|
|
|
|
**🍎 macOS :**
|
|
/Users/\<UserName\>/Library/Application Support/Godot/app_userdata/Kalulu/language_resources/
|
|
|
|
**🐧 Linux :**
|
|
/home/\<UserName\>/.local/share/godot/app_userdata/Kalulu/language_resources/
|
|
|
|
It is not possible to manually install the language pack on Android
|
|
files: |
|
|
build/Kalulu-Android-${{ inputs.release_name }}.zip
|
|
build/Kalulu-Android-32bits-${{ inputs.release_name }}.zip
|
|
build/Kalulu-Linux-${{ inputs.release_name }}.zip
|
|
build/Kalulu-macOS-${{ inputs.release_name }}.zip
|
|
build/Kalulu-Windows-${{ inputs.release_name }}.zip
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|