Skip to content

Instantly share code, notes, and snippets.

@doctor-g
Last active August 25, 2022 15:57
Show Gist options
  • Save doctor-g/57cd32c10beb04fcbd3b83f23f439d37 to your computer and use it in GitHub Desktop.
Save doctor-g/57cd32c10beb04fcbd3b83f23f439d37 to your computer and use it in GitHub Desktop.
GitHub workflow specification for publishing Godot Engine HTML5 projects to GitHub Pages
# Workflow to publish Godot HTML5 games to GitHub Pages
#
# Make sure your project is configured for Web export
# to the path `build/web`.
name: 'Publish to GitHub Pages'
env:
GODOT_VERSION: 3.2.2 # Remember to manually set image to this version below.
on:
workflow_dispatch:
push:
branches:
- master
jobs:
deploy:
runs-on: ubuntu-18.04
container:
image: barichello/godot-ci:3.2.2
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Move HTML5 templates into position
run: |
mkdir -v -p ~/.local/share/godot/templates
mv /root/.local/share/godot/templates/${GODOT_VERSION}.stable ~/.local/share/godot/templates/${GODOT_VERSION}.stable
- name: Create staging directory
run: mkdir -v -p build/web
- name: Build
run: godot -v --export "HTML5" build/web/index.html
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./build/web
force_orphan: true
user_name: 'github-ci[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'
commit_message: 'Publish to gh-pages'
@Atlinx
Copy link

Atlinx commented Aug 17, 2022

Is there a C# version for this?

I've tried making a C# version myself but I end up with exit code 1 with seemingly no errors.

Here's the messages I get leading up to the exit.

EditorSettings: Load OK!
Loaded builtin certs
EditorSettings: Save OK!
EditorSettings: Save OK!
Mono: Finalizing scripts domain...
Mono: Unloading scripts domain...
Mono: Runtime cleanup...
Mono: Finalized
Orphan StringName: BuildStateChanged
Orphan StringName: Invoke
StringName: 2 unclaimed string names at exit.
Error: Process completed with exit code 1.

EDIT:

I was actually using this workflow file: https://gist.github.com/doctor-g/c367da9f68ce0a429b2b067db8b60e3a.
The solution for was instead of using

godot -v --export "HTML5" ../build/web/index.html project/project.godot

I did

godot -v --export "HTML5" build/web/index.html project.godot

I realized I didn't separate my project into a separate folder under the repo, therefore I didn't need the project part. I also changed the build folder to be made within the repo for convenience.

@doctor-g
Copy link
Author

@Atlinx, I'm glad you got it sorted out. I always keep my build folder out of version control because it is generated, and I keep the project in its own folder so that I have somewhere else to keep raw assets. I give some explanation of that here, in case you're interested: https://youtu.be/7GxcM9AqozU

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment