fix(ci): ensure Godot export templates are present for web deployment #2
This file contains hidden or 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: "2D Web Deploy" | |
| on: | |
| push: | |
| branches: | |
| - main | |
| permissions: | |
| contents: write | |
| jobs: | |
| export_web: | |
| runs-on: ubuntu-latest | |
| container: | |
| image: barichello/godot-ci:4.3 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| lfs: true | |
| - name: Setup | |
| run: | | |
| mkdir -v -p build/web | |
| mkdir -v -p ~/.local/share/godot/export_templates/4.3.stable | |
| touch ~/.local/share/godot/export_templates/4.3.stable/web_release.zip | |
| # In barichello/godot-ci, templates are often pre-installed or need specific paths. | |
| # We'll use a more robust way to ensure templates exist if not present. | |
| - name: Install Templates (if needed) | |
| run: | | |
| if [ ! -f ~/.local/share/godot/export_templates/4.3.stable/web_release.zip ]; then | |
| wget https://github.com/godotengine/godot/releases/download/4.3-stable/Godot_v4.3-stable_export_templates.tpz | |
| unzip Godot_v4.3-stable_export_templates.tpz | |
| mkdir -p ~/.local/share/godot/export_templates/4.3.stable | |
| cp templates/* ~/.local/share/godot/export_templates/4.3.stable/ | |
| fi | |
| - name: Web Export | |
| run: | | |
| godot --headless --export-release "Web" build/web/index.html | |
| - name: Fix for GitHub Pages | |
| run: | | |
| sed -i 's/"ensureCrossOriginIsolationHeaders":true/"ensureCrossOriginIsolationHeaders":false/g' build/web/index.html | |
| - name: Upload Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: web-build | |
| path: build/web | |
| - name: Deploy to GitHub Pages | |
| uses: peaceiris/actions-gh-pages@v4 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ./build/web |