fix conditions? #43
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: export-optimized | |
on: | |
push: | |
branches: [rework-workflows] | |
pull_request: | |
branches: [ main ] | |
workflow_dispatch: | |
env: | |
GODOT_VERSION: 4.3 | |
GODOT_FEATURE_VERSION: 4.3 | |
GODOT_RELEASE: stable | |
PROJECT_NAME: GodSVG | |
GODOT_REPO: godotengine/godot | |
GODOT_COMMIT_HASH: 77dcf97 | |
BUILD_OPTIONS: target=template_release lto=full production=yes deprecated=no minizip=no brotli=no vulkan=no openxr=no use_volk=no disable_3d=yes modules_enabled_by_default=no module_freetype_enabled=yes module_gdscript_enabled=yes module_svg_enabled=yes module_jpg_enabled=yes module_text_server_adv_enabled=yes graphite=no module_webp_enabled=yes | |
jobs: | |
build-and-export: | |
name: Build and Export for ${{ matrix.platform }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
- platform: linux | |
os: ubuntu-latest | |
preset: "Linux/X11" | |
artifact: GodSVG.x86_64 | |
- platform: windows | |
os: ubuntu-latest | |
preset: "Windows Desktop" | |
artifact: GodSVG.exe | |
# - platform: macos | |
# os: macos-latest | |
# preset: "macOS" | |
# artifact: GodSVG.zip | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
path: godsvg | |
- name: Set up Godot editor | |
run: | | |
mkdir -v -p ~/godot-editor | |
cd ~/godot-editor | |
if [ $RUNNER_OS == 'Linux' ]; then | |
wget -q https://github.com/godotengine/godot-builds/releases/download/${GODOT_VERSION}-${GODOT_RELEASE}/Godot_v${GODOT_VERSION}-${GODOT_RELEASE}_linux.x86_64.zip | |
unzip Godot_v${GODOT_VERSION}-${GODOT_RELEASE}_linux.x86_64.zip | |
mv ./Godot_v${GODOT_VERSION}-${GODOT_RELEASE}_linux.x86_64 ~/godot-editor/godot | |
echo "~/godot-editor" >> $GITHUB_PATH | |
elif [ $RUNNER_OS == 'macOS' ]; then | |
wget -q https://github.com/godotengine/godot-builds/releases/download/${GODOT_VERSION}-${GODOT_RELEASE}/Godot_v${GODOT_VERSION}-${GODOT_RELEASE}_macos.universal.zip | |
unzip -a Godot_v${GODOT_VERSION}-${GODOT_RELEASE}_macos.universal.zip | |
echo "~/godot-editor/Godot.app/Contents/MacOS" >> $GITHUB_PATH | |
fi | |
- name: Install dependencies | |
run: | | |
if ["${{ matrix.platform }}" == 'macos']; then | |
brew install scons | |
fi | |
if ['${{ matrix.platform }}' == 'windows'] || ['${{ matrix.platform }}' == 'linux']; then | |
sudo apt update | |
sudo apt install -y scons python3 | |
fi | |
if ['${{ matrix.platform }}' == 'windows']; then | |
sudo apt install -y g++-mingw-w64-x86-64-posix | |
sudo apt install -y --fix-missing wine64 | |
wget -q https://github.com/electron/rcedit/releases/download/v2.0.0/rcedit-x64.exe | |
mkdir -v -p ~/.local/share/rcedit | |
mv rcedit-x64.exe ~/.local/share/rcedit | |
godot --headless --quit | |
echo 'export/windows/wine = "/usr/bin/wine64"' >> ~/.config/godot/editor_settings-${GODOT_FEATURE_VERSION}.tres | |
echo 'export/windows/rcedit = "/home/runner/.local/share/rcedit/rcedit-x64.exe"' >> ~/.config/godot/editor_settings-${GODOT_FEATURE_VERSION}.tres | |
fi | |
# TODO: Compile with angle libs | |
# if ['${{ matrix.platform }}' == 'windows'] || ['${{ matrix.platform }}' == 'macos']; then | |
# mkdir -p angle_libs | |
# pushd angle_libs | |
# base_url=https://github.com/godotengine/godot-angle-static/releases/download/chromium%2F6601.2/godot-angle-static | |
# curl -L -o windows_arm64.zip $base_url-arm64-llvm-release.zip | |
# curl -L -o windows_x86_64.zip $base_url-x86_64-gcc-release.zip | |
# curl -L -o windows_x86_32.zip $base_url-x86_32-gcc-release.zip | |
# curl -L -o macos_arm64.zip $base_url-arm64-macos-release.zip | |
# curl -L -o macos_x86_64.zip $base_url-x86_64-macos-release.zip | |
# unzip -o windows_arm64.zip && rm -f windows_arm64.zip | |
# unzip -o windows_x86_64.zip && rm -f windows_x86_64.zip | |
# unzip -o windows_x86_32.zip && rm -f windows_x86_32.zip | |
# unzip -o macos_arm64.zip && rm -f macos_arm64.zip | |
# unzip -o macos_x86_64.zip && rm -f macos_x86_64.zip | |
# popd | |
# fi | |
- name: Use cached export template | |
id: godot-template-cache | |
uses: | |
actions/cache@v4 | |
with: | |
key: ${{ env.GODOT_COMMIT_HASH }}-${{ matrix.platform}}-${{ env.BUILD_OPTIONS }} | |
path: | | |
~/.local/share/godot/export_templates/${{ env.GODOT_VERSION }}.${{ env.GODOT_RELEASE }} | |
- name: Get Godot source | |
if: ${{ steps.godot-template-cache.outputs.cache-hit != 'true' }} | |
uses: actions/checkout@v4 | |
with: | |
repository: ${{ env.GODOT_REPO }} | |
ref: ${{ env.GODOT_VERSION }} | |
path: godot | |
- name: Build Godot | |
if: ${{steps.godot-template-cache.outputs.cache-hit != 'true' }} | |
run: | | |
godot --help # Make sure godot command is available before wasting time building the template (Workflow would fail later and not cache it). | |
pushd godot | |
if ['${{ matrix.platform }}' == 'linux']; then | |
scons p=linuxbsd arch=x86_64 optimize=speed ${BUILD_OPTIONS} | |
mkdir -v -p ~/.local/share/godot/export_templates/${GODOT_VERSION}.${GODOT_RELEASE}/ | |
mv ./bin/godot.linuxbsd.template_release.x86_64 ~/.local/share/godot/export_templates/${GODOT_VERSION}.${GODOT_RELEASE}/linux_release.x86_64 | |
elif ['${{ matrix.platform }}' == 'windows']; then | |
echo 'Building winbows' | |
scons p=windows arch=x86_64 ${BUILD_OPTIONS} | |
mkdir -v -p ~/.local/share/godot/export_templates/${GODOT_VERSION}.${GODOT_RELEASE}/ | |
mv ./bin/godot.windows.template_release.x86_64.exe ~/.local/share/godot/export_templates/${GODOT_VERSION}.${GODOT_RELEASE}/windows_release_x86_64.exe | |
elif ['${{ matrix.platform }}' == 'macos']; then | |
scons p=macos arch=arm64 optimize=speed ${BUILD_OPTIONS} | |
scons p=macos arch=x86_64 optimize=speed ${BUILD_OPTIONS} | |
# TODO: Properly package this | |
pushd bin | |
lipo -create godot.macos.template_release.x86_64 godot.macos.template_release.arm64 -output godot.macos.template_release.universal | |
chmod +x * | |
mv godot.macos.template_release.universal "/Users/runner/Library/Application Support/Godot/export_templates/${GODOT_VERSION}.${GODOT_RELEASE}" | |
popd | |
fi | |
popd | |
- name: Export project | |
run: | | |
cd godsvg | |
mkdir -v -p build | |
godot --headless --export-release "${{ matrix.preset }}" build/${{ matrix.artifact }} | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.PROJECT_NAME }}-${{ matrix.platform }} | |
path: godsvg/build/${{ matrix.artifact }} | |
if-no-files-found: error | |
retention-days: 28 |