Files
godot_number_factory/.gitea/workflows/build.yaml
T
bionickatana 2d2485910f
Build Godot Project (Linux) / build-linux (push) Successful in 30s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 5s
mend
testing actions

Godot auto build

Godot auto build

Godot auto build

Godot auto build

Godot auto build

Finished adding items into the game along with auto build for linux.
2026-06-22 13:32:18 -06:00

83 lines
3.5 KiB
YAML

name: Build Godot Project (Linux)
on: [push]
jobs:
build-linux:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
# Step 1: Read project.godot ahead of time to get the version for our cache key
- name: Detect Godot Version
id: detect-version
run: |
echo "🔍 Parsing project.godot to identify the target engine version..."
VERSION_SHORT=$(grep "config/features" project.godot | sed -E 's/^[^\"]*\"([^\"]+)\".*/\1/' | xargs)
if [ -z "$VERSION_SHORT" ]; then
VERSION_SHORT="4.7"
fi
echo "VERSION_SHORT=${VERSION_SHORT}" >> $GITHUB_OUTPUT
echo "VERSION_URL=${VERSION_SHORT}-stable" >> $GITHUB_OUTPUT
echo "VERSION_FILE=${VERSION_SHORT}.stable" >> $GITHUB_OUTPUT
echo "🎯 Detected Target Version: $VERSION_SHORT"
# Step 2: Look for the cached Godot folder inside the Gitea Actions cache
- name: Cache Godot Engine and Templates
id: godot-cache
uses: actions/cache@v4
with:
path: .godot-cache-storage
key: godot-${{ steps.detect-version.outputs.VERSION_FILE }}-linux-v1
# Step 3: Run only on a Cache Miss to download the engine files
- name: Download Godot Engine and Templates (On Cache Miss)
if: steps.godot-cache.outputs.cache-hit != 'true'
run: |
VERSION_URL="${{ steps.detect-version.outputs.VERSION_URL }}"
mkdir -p .godot-cache-storage
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
move "Godot_v${VERSION_URL}_linux.x86_64" .godot-cache-storage/godot || mv "Godot_v${VERSION_URL}_linux.x86_64" .godot-cache-storage/godot
chmod +x .godot-cache-storage/godot
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
run: |
mkdir -p build/linux
./godot --headless --export-release "Linux" build/linux/godot_number_factory.x86_64
# Step 6: Upload artifacts using Gitea-compatible v3 action
- name: Upload Linux Build Artifact
uses: actions/upload-artifact@v3
with:
name: linux-build
path: build/linux/