Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions .github/actions/godot-build/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Build Godot
description: Build Godot with the provided options.

inputs:
target:
description: Build target (editor, template_release, template_debug).
default: editor
tests:
description: Unit tests.
default: false
required: false
platform:
description: Target platform.
required: false
sconsflags:
description: Additional SCons flags.
default: ''
required: false
scons-cache:
description: The SCons cache path.
default: ${{ github.workspace }}/.scons-cache/
scons-cache-limit:
description: The SCons cache size limit.
# actions/cache has 10 GiB limit, and GitHub runners have a 14 GiB disk.
# Limit to 7 GiB to avoid having the extracted cache fill the disk.
default: 7168

runs:
using: composite
steps:
- name: SCons Build
shell: sh
env:
SCONSFLAGS: ${{ inputs.sconsflags }}
SCONS_CACHE: ${{ inputs.scons-cache }}
SCONS_CACHE_LIMIT: ${{ inputs.scons-cache-limit }}
run: |
echo "Building with flags:" platform=${{ inputs.platform }} target=${{ inputs.target }} tests=${{ inputs.tests }} ${{ env.SCONSFLAGS }}

if [ "${{ inputs.target }}" != "editor" ]; then
# Ensure we don't include editor code in export template builds.
rm -rf editor
fi

scons platform=${{ inputs.platform }} target=${{ inputs.target }} tests=${{ inputs.tests }} ${{ env.SCONSFLAGS }}
ls -l bin/
32 changes: 32 additions & 0 deletions .github/actions/godot-deps/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Setup Python and SCons
description: Setup Python, install the pip version of SCons.

inputs:
python-version:
description: The Python version to use.
default: 3.x
python-arch:
description: The Python architecture.
default: x64
scons-version:
description: The SCons version to use.
default: 4.8.0

runs:
using: composite
steps:
- name: Set up Python 3.x
uses: actions/setup-python@v5
with:
# Semantic version range syntax or exact version of a Python version.
python-version: ${{ inputs.python-version }}
# Optional - x64 or x86 architecture, defaults to x64.
architecture: ${{ inputs.python-arch }}

- name: Setup SCons
shell: bash
run: |
python -c "import sys; print(sys.version)"
python -m pip install wheel
python -m pip install scons==${{ inputs.scons-version }}
scons --version
161 changes: 159 additions & 2 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,149 @@ on:
tags:
- "v*"

env:
GODOT_VERSION: 4.2.2

jobs:
macos_templates:
runs-on: macos-latest
name: Build MacOS Templates
steps:
- uses: actions/checkout@v3.3.0
with:
repository: godotengine/godot
ref: tags/${{ env.GODOT_VERSION }}-stable
submodules: "recursive"

- name: Get MacOS SCons Flags
run: curl https://raw.githubusercontent.com/MakovWait/godots/refs/heads/main/export_templates/macos-custom.py -o custom.py

- name: Setup Python and SCons
uses: ./.github/actions/godot-deps

- name: Compilation (release, x86_64)
uses: ./.github/actions/godot-build
with:
sconsflags: arch=x86_64 debug_symbols=no
platform: macos
target: template_release

- name: Compilation (debug, x86_64)
uses: ./.github/actions/godot-build
with:
sconsflags: arch=x86_64
platform: macos
target: template_debug

- name: Compilation (release, arm64)
uses: ./.github/actions/godot-build
with:
sconsflags: arch=arm64 debug_symbols=no
platform: macos
target: template_release

- name: Compilation (debug, arm64)
uses: ./.github/actions/godot-build
with:
sconsflags: arch=arm64
platform: macos
target: template_debug

- name: Prepare Artifact
run: |
lipo -create ./bin/godot.macos.template_release.x86_64 ./bin/godot.macos.template_release.arm64 -output ./bin/godot.macos.template_release.universal
rm ./bin/godot.macos.template_release.x86_64 ./bin/godot.macos.template_release.arm64
lipo -create ./bin/godot.macos.template_debug.x86_64 ./bin/godot.macos.template_debug.arm64 -output ./bin/godot.macos.template_debug.universal
rm ./bin/godot.macos.template_debug.x86_64 ./bin/godot.macos.template_debug.arm64
strip bin/godot.*
chmod +x bin/godot.*
cp -r misc/dist/macos_template.app .
mkdir -p macos_template.app/Contents/MacOS
cp bin/godot.macos.*.universal macos_template.app/Contents/MacOS/.
zip -q -9 -r macos.zip macos_template.app

- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: macos_export_template
path: macos.zip
# Default is 90 days.
retention-days: 60

linux_templates:
runs-on: ubuntu-latest
name: Build Linux Templates
steps:
- uses: actions/checkout@v3.3.0
with:
repository: godotengine/godot
ref: tags/${{ env.GODOT_VERSION }}-stable
submodules: "recursive"

- name: Get Linux SCons Flags
run: curl https://raw.githubusercontent.com/MakovWait/godots/refs/heads/main/export_templates/linuxbsd-custom.py -o custom.py

- name: Setup Python and SCons
uses: ./.github/actions/godot-deps

- name: Compilation (release)
uses: ./.github/actions/godot-build
with:
sconsflags: debug_symbols=no
platform: linuxbsd
target: template_release

- name: Compilation (debug)
uses: ./.github/actions/godot-build
with:
platform: linuxbsd
target: template_debug

- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: linux_export_templates
path: bin/godot.linuxbsd.*.x86_64
# Default is 90 days.
retention-days: 60

windows_templates:
runs-on: windows-latest
name: Build Windows Templates
steps:
- uses: actions/checkout@v3.3.0
with:
repository: godotengine/godot
ref: tags/${{ env.GODOT_VERSION }}-stable
submodules: "recursive"

- name: Get Windows SCons Flags
run: curl https://raw.githubusercontent.com/MakovWait/godots/refs/heads/main/export_templates/windows-custom.py -o custom.py

- name: Setup Python and SCons
uses: ./.github/actions/godot-deps

- name: Compilation (release)
uses: ./.github/actions/godot-build
with:
sconsflags: debug_symbols=no
platform: windows
target: template_release

- name: Compilation (debug)
uses: ./.github/actions/godot-build
with:
platform: windows
target: template_debug

- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: windows_export_templates
path: bin/godot.windows.*.x86_64.exe
# Default is 90 days.
retention-days: 60

# job id, can be anything
export_game:
# Always use ubuntu-latest for this action
Expand All @@ -27,14 +169,29 @@ jobs:
sudo apt install wine64
echo "WINE_PATH=$(which wine64)" >> $GITHUB_OUTPUT

- uses: actions/download-artifact@v4
with:
name: macos_export_template
path: export_templates

- uses: actions/download-artifact@v4
with:
name: linux_export_templates
path: export_templates

- uses: actions/download-artifact@v4
with:
name: windows_export_templates
path: export_templates

- name: export game
id: export
# Use latest version (see releases for all versions)
uses: firebelley/godot-export@v5.2.1
with:
# Defining all the required inputs
godot_executable_download_url: https://github.com/godotengine/godot-builds/releases/download/4.2.2-rc2/Godot_v4.2.2-rc2_linux.x86_64.zip
godot_export_templates_download_url: https://github.com/godotengine/godot-builds/releases/download/4.2.2-rc2/Godot_v4.2.2-rc2_export_templates.tpz
godot_executable_download_url: https://github.com/godotengine/godot-builds/releases/download/${{ env.GODOT_VERSION }}-stable/Godot_v${{ env.GODOT_VERSION }}-stable_linux.x86_64.zip
godot_export_templates_download_url: https://github.com/godotengine/godot-builds/releases/download/${{ env.GODOT_VERSION }}-stable/Godot_v${{ env.GODOT_VERSION }}-stable_export_templates.tpz
relative_project_path: .
archive_output: true
wine_path: ${{ steps.wine_install.outputs.WINE_PATH }}
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ mono_crash.*.json
.plugged/

trash/
builds/

addons/gd-plug-ui
addons/expand-region
Expand Down
15 changes: 9 additions & 6 deletions export_presets.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ encrypt_directory=false

export/distribution_type=1
binary_format/architecture="universal"
custom_template/debug=""
custom_template/release=""
custom_template/debug="./export_templates/macos.zip"
custom_template/release="./export_templates/macos.zip"
debug/export_console_wrapper=1
application/icon=""
application/icon_interpolation=4
Expand All @@ -31,6 +31,7 @@ application/version="1.0"
application/copyright=""
application/copyright_localized={}
application/min_macos_version="10.12"
application/export_angle=0
display/high_res=true
xcode/platform_build="14C18"
xcode/sdk_version="13.1"
Expand Down Expand Up @@ -64,6 +65,7 @@ codesign/entitlements/app_sandbox/files_downloads=0
codesign/entitlements/app_sandbox/files_pictures=0
codesign/entitlements/app_sandbox/files_music=0
codesign/entitlements/app_sandbox/files_movies=0
codesign/entitlements/app_sandbox/files_user_selected=0
codesign/entitlements/app_sandbox/helper_executables=[]
codesign/custom_options=PackedStringArray()
notarization/notarization=0
Expand Down Expand Up @@ -119,8 +121,8 @@ encrypt_directory=false

[preset.1.options]

custom_template/debug=""
custom_template/release=""
custom_template/debug="./export_templates/godot.linuxbsd.template_debug.x86_64"
custom_template/release="./export_templates/godot.linuxbsd.template_release.x86_64"
debug/export_console_wrapper=1
binary_format/embed_pck=true
texture_format/bptc=true
Expand Down Expand Up @@ -159,8 +161,8 @@ encrypt_directory=false

[preset.2.options]

custom_template/debug=""
custom_template/release=""
custom_template/debug="./export_templates/godot.windows.template_debug.x86_64.exe"
custom_template/release="./export_templates/godot.windows.template_release.x86_64.exe"
debug/export_console_wrapper=1
binary_format/embed_pck=true
texture_format/bptc=true
Expand All @@ -185,6 +187,7 @@ application/product_name=""
application/file_description=""
application/copyright=""
application/trademarks=""
application/export_angle=0
ssh_remote_deploy/enabled=false
ssh_remote_deploy/host="user@host_ip"
ssh_remote_deploy/port="22"
Expand Down
29 changes: 29 additions & 0 deletions export_templates/TEMPLATES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Building Custom Export Templates

## Summary

This document outlines how to build minimized export templates for Godots. It assumes you have read and understand the basics of [building from source](https://docs.godotengine.org/en/stable/contributing/development/compiling/index.html) and [optimizing a build for size](https://docs.godotengine.org/en/stable/contributing/development/compiling/optimizing_for_size.html). Each template must be built from the associated platform.

## Building

First, the Godot git repository must be synced the the tag matching the version used by Godots.

For example:

```sh
git checkout tags/4.2.2-stable
```

Then you can use `scons` to build templates using Godots' `{platform}-custom.py` files.

```sh
scons profile=path/to/{platform}-custom.py platform={platform} target=template_release
```

The generated templates will be in the `bin` directory and can be copied over to the `release_templates` directory in the Godots project. The process can be repeated for `template_debug`.

**NOTE:** MacOS has [additonal steps to follow](https://docs.godotengine.org/en/stable/contributing/development/compiling/compiling_for_macos.html#building-export-templates) to attain the proper files and architecture support.

## Usage

The `export_presets.cfg` file is pre-configured to use these templates. You can verify they have not changed by viewing the custom template fields in the export window. **If the project's engine version ever changes, the templates need to be rebuilt.**
19 changes: 19 additions & 0 deletions export_templates/linuxbsd-custom.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
production = "yes"
optimize = "size"
lto = "full"
disable_3d = "yes"
deprecated = "no"
vulkan = "no"
openxr = "no"
modules_enabled_by_default = "no"
module_freetype_enabled = "yes"
module_gdscript_enabled = "yes"
module_jpg_enabled = "yes"
module_mbedtls_enabled = "yes"
module_regex_enabled = "yes"
module_text_server_fb_enabled = "yes"
module_webp_enabled = "yes"
module_zip_enabled = "yes"
alsa = "no"
pulseaudio = "no"
udev = "no"
16 changes: 16 additions & 0 deletions export_templates/macos-custom.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
production = "yes"
optimize = "size"
lto = "full"
disable_3d = "yes"
deprecated = "no"
vulkan = "no"
openxr = "no"
modules_enabled_by_default = "no"
module_freetype_enabled = "yes"
module_gdscript_enabled = "yes"
module_jpg_enabled = "yes"
module_mbedtls_enabled = "yes"
module_regex_enabled = "yes"
module_text_server_fb_enabled = "yes"
module_webp_enabled = "yes"
module_zip_enabled = "yes"
Loading