Skip to content

Commit

Permalink
Workflows: Download and cache Godot Engine for build
Browse files Browse the repository at this point in the history
Rather than relying on downloading and executing in a third-party container, we can just grab Godot Engine and the export templates directly from the upstream release page.

We cache these downloads so future runs have the binaries and templates (the latter of which are quite large) available right away for the run.
  • Loading branch information
cassidyjames committed Dec 16, 2024
1 parent ca69811 commit 40d5ddd
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 7 deletions.
42 changes: 35 additions & 7 deletions .github/workflows/github-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,23 +46,51 @@ jobs:
- check
if: ${{ needs.check.outputs.enabled }}
runs-on: ubuntu-latest
container:
image: barichello/godot-ci:4.3
steps:
- name: Checkout
uses: actions/checkout@v4
with:
lfs: true

- name: Set up export templates
- name: Cache Godot Engine downloads
id: cache-godot
uses: actions/cache@v4
with:
path: |
build/godot
build/._sc_
build/editor_data/export_templates/${{ env.GODOT_VERSION }}.stable
key: godot-${{ env.GODOT_VERSION }}

- name: Download Godot Engine from GitHub release
id: download
if: steps.cache-godot.outputs.cache-hit != 'true'
run: |
mkdir -v -p ~/.local/share/godot/export_templates/
mv /root/.local/share/godot/export_templates/${GODOT_VERSION}.stable ~/.local/share/godot/export_templates/${GODOT_VERSION}.stable
mkdir -p build && cd build
# Download Godot Engine itself
wget https://github.com/godotengine/godot/releases/download/${GODOT_VERSION}-stable/Godot_v${GODOT_VERSION}-stable_linux.x86_64.zip && \
unzip Godot_v${GODOT_VERSION}-stable_linux.x86_64.zip && \
mv Godot_v${GODOT_VERSION}-stable_linux.x86_64 godot
# Download export templates
mkdir -p editor_data/export_templates
wget https://github.com/godotengine/godot/releases/download/${GODOT_VERSION}-stable/Godot_v${GODOT_VERSION}-stable_export_templates.tpz && \
unzip Godot_v${GODOT_VERSION}-stable_export_templates.tpz && \
mv templates editor_data/export_templates/${GODOT_VERSION}.stable
# Tell Godot Engine to run in "self-contained" mode so it looks for
# templates here instead of in ~/.local/share/godot/
touch ._sc_
- name: Web Build
run: |
mkdir -v -p build/web
godot --headless --verbose --export-release "Web" ./build/web/index.html
mkdir -v -p build/web && cd build
# Note that the export path can be confusing; it's relative to the
# Godot project path, NOT necessarily the current directory or Godot
# binary location
./godot --headless --verbose --path ../ --export-release "Web" ./build/web/index.html
- name: Upload Artifact
uses: actions/upload-pages-artifact@v3
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
# Godot 4+ specific ignores
.godot/

# Working directory
build/

0 comments on commit 40d5ddd

Please sign in to comment.