Godot auto build
CI Built-in Cache Test / test-cache (push) Successful in 7s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 6s

This commit is contained in:
2026-06-22 11:37:39 -06:00
parent 8d0d92a10a
commit 6aa4501c27
+50 -40
View File
@@ -9,8 +9,9 @@ jobs:
- name: Check out repository code - name: Check out repository code
uses: actions/checkout@v4 uses: actions/checkout@v4
# Step 1: Read project.godot ahead of time to get the version for our cache key
- name: Auto-Detect Godot Version and Setup Engine (With Caching) - name: Detect Godot Version
id: detect-version
run: | run: |
echo "🔍 Parsing project.godot to identify the target engine version..." echo "🔍 Parsing project.godot to identify the target engine version..."
VERSION_SHORT=$(grep "config/features" project.godot | sed -E 's/^[^\"]*\"([^\"]+)\".*/\1/' | xargs) VERSION_SHORT=$(grep "config/features" project.godot | sed -E 's/^[^\"]*\"([^\"]+)\".*/\1/' | xargs)
@@ -19,55 +20,64 @@ jobs:
VERSION_SHORT="4.7" VERSION_SHORT="4.7"
fi fi
VERSION_URL="${VERSION_SHORT}-stable" echo "VERSION_SHORT=${VERSION_SHORT}" >> $GITHUB_OUTPUT
VERSION_FILE="${VERSION_SHORT}.stable" echo "VERSION_URL=${VERSION_SHORT}-stable" >> $GITHUB_OUTPUT
echo "VERSION_FILE=${VERSION_SHORT}.stable" >> $GITHUB_OUTPUT
# Paths inside our persistent volume
CACHE_DIR="/root/.godot-si-cache/${VERSION_FILE}"
echo "🎯 Detected Target Version: $VERSION_SHORT" echo "🎯 Detected Target Version: $VERSION_SHORT"
echo "----------------------------------------------"
# Check if this specific version is already cached # Step 2: Look for the cached Godot folder inside the Gitea Actions cache
if [ -f "${CACHE_DIR}/godot" ] && [ -f "${CACHE_DIR}/linux_release.x86_64" ]; then - name: Cache Godot Engine and Templates
echo "🚀 Cache Hit! Found Godot ${VERSION_SHORT} locally. Copying files..." id: godot-cache
cp "${CACHE_DIR}/godot" ./godot uses: actions/cache@v4
mkdir -p ~/.local/share/godot/export_templates/${VERSION_FILE} with:
cp "${CACHE_DIR}/linux_release.x86_64" ~/.local/share/godot/export_templates/${VERSION_FILE}/linux_release.x86_64 path: .godot-cache-storage
else key: godot-${{ steps.detect-version.outputs.VERSION_FILE }}-linux-v1
echo "📥 Cache Miss. Downloading Godot Engine ($VERSION_URL)..."
curl -L "https://github.com/godotengine/godot/releases/download/${VERSION_URL}/Godot_v${VERSION_URL}_linux.x86_64.zip" -o godot.zip
unzip godot.zip
mv "Godot_v${VERSION_URL}_linux.x86_64" godot
chmod +x godot
echo "📥 Downloading Export Templates ($VERSION_URL)..." # Step 3: Run only on a Cache Miss to download the engine files
curl -L "https://github.com/godotengine/godot/releases/download/${VERSION_URL}/Godot_v${VERSION_URL}_export_templates.tpz" -o templates.zip - name: Download Godot Engine and Templates (On Cache Miss)
unzip templates.zip if: steps.godot-cache.outputs.cache-hit != 'true'
run: |
echo "🔧 Mapping Template Directories..." VERSION_URL="${{ steps.detect-version.outputs.VERSION_URL }}"
mkdir -p ~/.local/share/godot/export_templates/${VERSION_FILE} mkdir -p .godot-cache-storage
mv templates/linux_release.x86_64 ~/.local/share/godot/export_templates/${VERSION_FILE}/linux_release.x86_64
echo "📥 Cache Miss. Downloading Godot Engine ($VERSION_URL)..."
echo "💾 Saving files to persistent host cache for next time..." curl -L "https://github.com/godotengine/godot/releases/download/${VERSION_URL}/Godot_v${VERSION_URL}_linux.x86_64.zip" -o godot.zip
mkdir -p "${CACHE_DIR}" unzip godot.zip
cp ./godot "${CACHE_DIR}/godot" mv "Godot_v${VERSION_URL}_linux.x86_64" .godot-cache-storage/godot
cp ~/.local/share/godot/export_templates/${VERSION_FILE}/linux_release.x86_64 "${CACHE_DIR}/linux_release.x86_64" chmod +x .godot-cache-storage/godot
fi
echo "📥 Downloading Export Templates ($VERSION_URL)..."
curl -L "https://github.com/godotengine/godot/releases/download/${VERSION_URL}/Godot_v${VERSION_URL}_export_templates.tpz" -o templates.zip
unzip templates.zip
mv templates/linux_release.x86_64 .godot-cache-storage/linux_release.x86_64
# Clean up download archives
rm godot.zip templates.zip
rm -rf templates/
# Step 4: Always map the binaries from our local workspace folder into their final execution paths
- name: Map Engine and Templates
run: |
VERSION_FILE="${{ steps.detect-version.outputs.VERSION_FILE }}"
# Copy engine executable out to project root
cp .godot-cache-storage/godot ./godot
# Inject template into user profile folder where Godot looks for them during exports
mkdir -p ~/.local/share/godot/export_templates/${VERSION_FILE}
cp .godot-cache-storage/linux_release.x86_64 ~/.local/share/godot/export_templates/${VERSION_FILE}/linux_release.x86_64
echo "🚀 Environment ready for export!"
# Step 5: Export the binary
- name: Export Linux Binary - name: Export Linux Binary
run: | run: |
mkdir -p "${{ gitea.workspace }}/build/linux"
mkdir -p build/linux mkdir -p build/linux
./godot --headless --export-release "Linux" build/linux/godot_number_factory.x86_64 ./godot --headless --export-release "Linux" build/linux/godot_number_factory.x86_64
- name: debug # Step 6: Upload artifacts using action version safety features compatible with Gitea
run: |
ls -la "${{ gitea.workspace }}/build/linux"
ls -la build/linux
- name: Upload Linux Build Artifact - name: Upload Linux Build Artifact
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: linux-build name: linux-build
path: build/linux/ path: build/linux/
if-no-files-found: error