mirror of
https://github.com/godotengine/godot-demo-projects.git
synced 2025-12-15 13:00:07 +01:00
Bumps [actions/checkout](https://github.com/actions/checkout) from 5 to 6. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v5...v6) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: '6' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
129 lines
5.8 KiB
YAML
129 lines
5.8 KiB
YAML
name: Export projects to Web and deploy to GitHub Pages
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
|
|
env:
|
|
GODOT_VERSION: 4.3
|
|
|
|
jobs:
|
|
export-html5:
|
|
if: github.repository == 'godotengine/godot-demo-projects'
|
|
name: Export projects to Web and deploy to GitHub Pages
|
|
runs-on: ubuntu-24.04
|
|
container:
|
|
image: barichello/godot-ci:4.3
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Setup
|
|
run: |
|
|
mkdir -p ~/.local/share/godot/export_templates/
|
|
mv /root/.local/share/godot/export_templates/$GODOT_VERSION.stable ~/.local/share/godot/export_templates/$GODOT_VERSION.stable
|
|
|
|
- name: Export projects to Web
|
|
run: |
|
|
apt-get update -qq && apt-get install -qqq imagemagick
|
|
|
|
# Don't export Mono demos (not supported yet), demos that can't be run in Web
|
|
# since they're platform-specific or demos that are currently broken in Web.
|
|
# Remember to update `.github/dist/footer.html` when updating the list of excluded demos.
|
|
rm -rf \
|
|
2d/glow/ \
|
|
2d/navigation_mesh_chunks/ \
|
|
2d/physics_tests/ \
|
|
3d/labels_and_texts/ \
|
|
3d/decals/ \
|
|
3d/ik/ \
|
|
3d/navigation_mesh_chunks/ \
|
|
3d/occlusion_culling_mesh_lod/ \
|
|
3d/particles/ \
|
|
3d/physical_light_camera_units/ \
|
|
3d/physics_tests/ \
|
|
3d/variable_rate_shading/ \
|
|
3d/volumetric_fog/ \
|
|
3d/voxel/ \
|
|
audio/bpm_sync/ \
|
|
audio/device_changer/ \
|
|
audio/midi_piano/ \
|
|
audio/spectrum/ \
|
|
compute/ \
|
|
gui/msdf_font/ \
|
|
gui/translation/ \
|
|
loading/runtime_save_load \
|
|
misc/compute_shader_heightmap \
|
|
misc/large_world_coordinates/ \
|
|
misc/matrix_transform/ \
|
|
mobile/android_iap/ \
|
|
mobile/sensors/ \
|
|
mono/ \
|
|
networking/ \
|
|
plugins/ \
|
|
xr/openxr_character_centric_movement \
|
|
xr/openxr_composition_layers \
|
|
xr/openxr_hand_tracking_demo \
|
|
xr/openxr_origin_centric_movement
|
|
|
|
for panorama in 3d/material_testers/backgrounds/*.hdr; do
|
|
# Decrease the resolution to get below the 100 MB PCK size limit.
|
|
# Otherwise, the website can't be deployed as files larger than 100 MB
|
|
# can't be pushed to GitHub.
|
|
mogrify -resize 66.667% "$panorama"
|
|
done
|
|
|
|
BASEDIR="$PWD"
|
|
|
|
# Use absolute paths so that we can `cd` without having to go back to the parent directory manually.
|
|
for demo in */*/; do
|
|
echo ""
|
|
echo ""
|
|
echo "================================================================================"
|
|
echo "Exporting demo $demo..."
|
|
echo "================================================================================"
|
|
|
|
mkdir -p "$BASEDIR/.github/dist/$demo"
|
|
cd "$BASEDIR/$demo"
|
|
|
|
# Copy an export template preset file configured for Web exporting.
|
|
# This way, we don't have to commit `export_presets.cfg` for each project.
|
|
cp "$BASEDIR/.github/dist/export_presets.cfg" .
|
|
# Enable ETC2 texture importing, which is disabled by default (but required for web exports to work on mobile platforms).
|
|
echo "[rendering]\n\ntextures/vram_compression/import_etc2_astc=true" >> project.godot
|
|
|
|
# Enable WebXR Polyfill and WebXR Layers Polyfill for the WebXR demo.
|
|
if [ "$demo" == "xr/webxr/" ]; then
|
|
sed -i 's~^html/head_include=""$~html/head_include="<script src=\\"https://cdn.jsdelivr.net/npm/webxr-polyfill@latest/build/webxr-polyfill.min.js\\"></script>\n<script>\nvar polyfill = new WebXRPolyfill();\n</script>\n<script src=\\"https://cdn.jsdelivr.net/npm/webxr-layers-polyfill@latest/build/webxr-layers-polyfill.min.js\\"></script>\n<script>\nvar layersPolyfill = new WebXRLayersPolyfill();\n</script>"~g' export_presets.cfg
|
|
fi
|
|
|
|
godot --verbose --headless --export-release "Web" "$BASEDIR/.github/dist/$demo/index.html"
|
|
|
|
# Replace the WASM file with a symbolic link to avoid duplicating files in the pushed branch.
|
|
# (WASM files are identical across projects, but not PCK or HTML/JavaScript files.)
|
|
mv -f "$BASEDIR/.github/dist/$demo/index.wasm" "$BASEDIR/.github/dist/index.wasm"
|
|
# The symlink must be relative as it needs to point to a file within the pushed repository.
|
|
ln -s "../../index.wasm" "$BASEDIR/.github/dist/$demo/index.wasm"
|
|
|
|
# Append the demo to the list of demos for the website.
|
|
PROJECT_NAME=$(cat project.godot | grep "config/name" | cut -d '"' -f 2 | tr -d "\n")
|
|
echo "<li><a href='$demo'><img width="64" height="64" src="$demo/index.icon.png" alt=""><p>$PROJECT_NAME</p></a></li>" >> "$BASEDIR/.github/dist/demos.html"
|
|
done
|
|
|
|
cat "$BASEDIR/.github/dist/header.html" "$BASEDIR/.github/dist/demos.html" "$BASEDIR/.github/dist/footer.html" > "$BASEDIR/.github/dist/index.html"
|
|
|
|
# Clean up files that don't need to be deployed.
|
|
rm -f "$BASEDIR/.github/dist/header.html" "$BASEDIR/.github/dist/demos.html" "$BASEDIR/.github/dist/footer.html" "$BASEDIR/.github/dist/export_presets.cfg"
|
|
|
|
# Installing rsync is needed in order to deploy to GitHub Pages. Without it, the build will fail.
|
|
- name: Install rsync 📚
|
|
run: |
|
|
apt-get update -qq && apt-get install -qqq rsync
|
|
- name: Deploy to GitHub Pages 🚀
|
|
uses: JamesIves/github-pages-deploy-action@releases/v4
|
|
with:
|
|
# The folder the action should deploy.
|
|
folder: .github/dist
|
|
# Artifacts are large; don't keep the branch's history.
|
|
single-commit: true
|