1+ name : Build & Deploy Multi-Platform
2+
3+ on :
4+ push :
5+ branches :
6+ - master
7+
8+ jobs :
9+ build :
10+ name : Build for ${{ matrix.targetPlatform }}
11+ runs-on : ubuntu-latest
12+ strategy :
13+ fail-fast : false
14+ matrix :
15+ targetPlatform :
16+ - WebGL
17+ - StandaloneWindows64
18+ - StandaloneOSX
19+ steps :
20+ # Free up disk space to avoid "no space left on device" errors
21+ - name : Free Disk Space
22+ run : |
23+ sudo rm -rf /usr/share/dotnet
24+ sudo rm -rf /usr/local/lib/android
25+ sudo rm -rf /opt/ghc
26+
27+ - name : Checkout code
28+ uses : actions/checkout@v4
29+ with :
30+ lfs : true
31+
32+ # Extract Unity version from project settings
33+ - name : Get Unity Version
34+ id : get-unity-version
35+ run : |
36+ UNITY_VER=$(grep 'm_EditorVersion:' ProjectSettings/ProjectVersion.txt | awk '{print $2}')
37+ echo "version=$UNITY_VER" >> $GITHUB_OUTPUT
38+
39+ # Restore Library cache specifically for each platform
40+ - name : Restore Library cache
41+ uses : actions/cache@v4
42+ with :
43+ path : Library
44+ key : Library-${{ matrix.targetPlatform }}-${{ steps.get-unity-version.outputs.version }}-${{ hashFiles('Packages/manifest.json') }}
45+ restore-keys : |
46+ Library-${{ matrix.targetPlatform }}-${{ steps.get-unity-version.outputs.version }}-
47+ Library-${{ matrix.targetPlatform }}-
48+
49+ - name : Unity Build
50+ uses : game-ci/unity-builder@v4
51+ id : unityBuild
52+ env :
53+ UNITY_LICENSE : ${{ secrets.UNITY_LICENSE }}
54+ UNITY_EMAIL : ${{ secrets.UNITY_EMAIL }}
55+ UNITY_PASSWORD : ${{ secrets.UNITY_PASSWORD }}
56+ with :
57+ targetPlatform : ${{ matrix.targetPlatform }}
58+ unityVersion : ${{ steps.get-unity-version.outputs.version }}
59+ buildName : FallingBlocks
60+ buildsPath : build
61+
62+ - name : Upload Artifact
63+ uses : actions/upload-artifact@v4
64+ with :
65+ name : build-${{ matrix.targetPlatform }}
66+ path : build/${{ matrix.targetPlatform }}
67+
68+ deploy :
69+ name : Deploy to itch.io (${{ matrix.targetPlatform }})
70+ needs : build
71+ runs-on : ubuntu-latest
72+ strategy :
73+ matrix :
74+ targetPlatform :
75+ - WebGL
76+ - StandaloneWindows64
77+ - StandaloneOSX
78+ # Map Unity platforms to itch.io channels
79+ include :
80+ - targetPlatform : WebGL
81+ itchChannel : html5
82+ - targetPlatform : StandaloneWindows64
83+ itchChannel : windows
84+ - targetPlatform : StandaloneOSX
85+ itchChannel : mac
86+ steps :
87+ - name : Download Artifact
88+ uses : actions/download-artifact@v4
89+ with :
90+ name : build-${{ matrix.targetPlatform }}
91+ path : build/${{ matrix.targetPlatform }}
92+
93+ - name : Butler Deploy
94+ uses : manleydev/butler-publish-itchio-action@master
95+ env :
96+ BUTLER_CREDENTIALS : ${{ secrets.BUTLER_CREDENTIALS }}
97+ CHANNEL : ${{ matrix.itchChannel }}
98+ ITCH_GAME : falling-blocks
99+ ITCH_USER : Exenter
100+ PACKAGE : build/${{ matrix.targetPlatform }}
101+ VERSION : ${{ github.run_number }}
0 commit comments