Godot auto build
This commit is contained in:
@@ -9,27 +9,33 @@ jobs:
|
|||||||
- name: Check out repository code
|
- name: Check out repository code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Auto-Detect Godot Version and Setup Engine
|
|
||||||
|
- name: Auto-Detect Godot Version and Setup Engine (With Caching)
|
||||||
run: |
|
run: |
|
||||||
echo "🔍 Parsing project.godot to identify the target engine version..."
|
echo "🔍 Parsing project.godot to identify the target engine version..."
|
||||||
|
|
||||||
# Extracts the first value out of config/features (e.g., "4.7")
|
|
||||||
# Finds the line, isolates the contents of the first set of quotes, and strips spaces
|
|
||||||
VERSION_SHORT=$(grep "config/features" project.godot | sed -E 's/^[^\"]*\"([^\"]+)\".*/\1/' | xargs)
|
VERSION_SHORT=$(grep "config/features" project.godot | sed -E 's/^[^\"]*\"([^\"]+)\".*/\1/' | xargs)
|
||||||
|
|
||||||
if [ -z "$VERSION_SHORT" ]; then
|
if [ -z "$VERSION_SHORT" ]; then
|
||||||
echo "❌ Error: Could not determine Godot version from project.godot. Defaulting to 4.7"
|
|
||||||
VERSION_SHORT="4.7"
|
VERSION_SHORT="4.7"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Standardizes the formatting naming convention for paths vs engine filenames
|
|
||||||
VERSION_URL="${VERSION_SHORT}-stable"
|
VERSION_URL="${VERSION_SHORT}-stable"
|
||||||
VERSION_FILE="${VERSION_SHORT}.stable"
|
VERSION_FILE="${VERSION_SHORT}.stable"
|
||||||
|
|
||||||
|
# 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 "----------------------------------------------"
|
echo "----------------------------------------------"
|
||||||
|
|
||||||
echo "📥 Downloading Godot Engine ($VERSION_URL)..."
|
# Check if this specific version is already cached
|
||||||
|
if [ -f "${CACHE_DIR}/godot" ] && [ -f "${CACHE_DIR}/linux_release.x86_64" ]; then
|
||||||
|
echo "🚀 Cache Hit! Found Godot ${VERSION_SHORT} locally. Copying files..."
|
||||||
|
cp "${CACHE_DIR}/godot" ./godot
|
||||||
|
mkdir -p ~/.local/share/godot/export_templates/${VERSION_FILE}
|
||||||
|
cp "${CACHE_DIR}/linux_release.x86_64" ~/.local/share/godot/export_templates/${VERSION_FILE}/linux_release.x86_64
|
||||||
|
else
|
||||||
|
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
|
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
|
unzip godot.zip
|
||||||
mv "Godot_v${VERSION_URL}_linux.x86_64" godot
|
mv "Godot_v${VERSION_URL}_linux.x86_64" godot
|
||||||
@@ -43,11 +49,21 @@ jobs:
|
|||||||
mkdir -p ~/.local/share/godot/export_templates/${VERSION_FILE}
|
mkdir -p ~/.local/share/godot/export_templates/${VERSION_FILE}
|
||||||
mv templates/linux_release.x86_64 ~/.local/share/godot/export_templates/${VERSION_FILE}/linux_release.x86_64
|
mv templates/linux_release.x86_64 ~/.local/share/godot/export_templates/${VERSION_FILE}/linux_release.x86_64
|
||||||
|
|
||||||
|
echo "💾 Saving files to persistent host cache for next time..."
|
||||||
|
mkdir -p "${CACHE_DIR}"
|
||||||
|
cp ./godot "${CACHE_DIR}/godot"
|
||||||
|
cp ~/.local/share/godot/export_templates/${VERSION_FILE}/linux_release.x86_64 "${CACHE_DIR}/linux_release.x86_64"
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Export Linux Binary
|
- name: Export Linux Binary
|
||||||
run: |
|
run: |
|
||||||
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
|
||||||
|
run: |
|
||||||
|
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:
|
||||||
|
|||||||
Reference in New Issue
Block a user