Skip to content

Instantly share code, notes, and snippets.

@russmatney
Last active July 17, 2024 16:20
Show Gist options
  • Save russmatney/ef865144f92a92386edd2cf38ce9ee97 to your computer and use it in GitHub Desktop.
Save russmatney/ef865144f92a92386edd2cf38ce9ee97 to your computer and use it in GitHub Desktop.
Build and Deploy Unity WebGL to Itch
# .github/workflows/build_and_deploy_to_itch.yml
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/[email protected]
with:
name: build-WebGL
path: build
- uses: KikimoraGames/[email protected]
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment