Skip to content

Instantly share code, notes, and snippets.

@russmatney
Last active August 19, 2025 18:13
Show Gist options
  • Select an option

  • Save russmatney/5db214722f7291a059341a51c387e888 to your computer and use it in GitHub Desktop.

Select an option

Save russmatney/5db214722f7291a059341a51c387e888 to your computer and use it in GitHub Desktop.
Unity build and deploy via game-ci on github actions
name: Build and Deploy for WebGL ItchIo
on:
workflow_dispatch: {}
push:
branches:
- deploy
jobs:
buildWebGL:
name: Build for WebGL 🖥️
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
lfs: true
- name: Restore Library cache
uses: actions/cache@v3
with:
path: Library
key: Library-build-WebGL
restore-keys: |
Library-build-
Library-
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
# - uses: game-ci/unity-test-runner@v4
# env:
# UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
# UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
# UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
# with:
# githubToken: ${{ secrets.GITHUB_TOKEN }}
- uses: game-ci/unity-builder@v4
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
with:
targetPlatform: WebGL
- uses: actions/upload-artifact@v3
with:
name: build-WebGL
path: build/WebGL
deployItchIo:
name: Upload to Itch
needs: buildWebGL
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
channel:
- webgl
steps:
- uses: actions/download-artifact@v2.0.8
with:
name: build-WebGL
path: build
- uses: KikimoraGames/itch-publish@v0.0.3
with:
butlerApiKey: ${{ secrets.BUTLER_API_KEY }}
gameData: ./build/${{ matrix.template }}
itchUsername: ${{ vars.ITCH_USERNAME }}
itchGameId: ${{ vars.ITCH_GAME_ID }}
buildChannel: ${{ matrix.channel }}
buildNumber: ${{ needs.version.outputs.version_hash }}
- name: Cleanup to avoid storage limit
if: always()
uses: geekyeggo/delete-artifact@v1
with:
name: build-WebGL

The tricky bit for this was getting a unity license into the secrets. There's some docs on this here: https://game.ci/docs/github/activation#personal-license

I created a new unity account explicitly for this usage so i didn't need to use my own.

--

Just noting that I abandoned using this at all b/c it ran so slow ~40 minutes. This could probably be mitigated if you pay for a bigger CI machine, but I settled for building and deploying locally via butler (itch's cli tool)

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