From 2435e67a6e212e02fa3f91ca71ac1880cd647a80 Mon Sep 17 00:00:00 2001 From: KoalaTrapLord Date: Wed, 18 Mar 2026 15:19:13 -0400 Subject: [PATCH] Add Unity CI/CD workflow for Windows + WebGL builds (closes #59) --- .github/workflows/unity-build.yml | 60 +++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 .github/workflows/unity-build.yml diff --git a/.github/workflows/unity-build.yml b/.github/workflows/unity-build.yml new file mode 100644 index 0000000..4c43ad7 --- /dev/null +++ b/.github/workflows/unity-build.yml @@ -0,0 +1,60 @@ +name: Unity Build (Windows + WebGL) + +on: + push: + branches: [main] + paths: + - 'unity-client/**' + pull_request: + branches: [main] + paths: + - 'unity-client/**' + workflow_dispatch: + +env: + UNITY_PROJECT_PATH: unity-client + +jobs: + build: + name: Build ${{ matrix.targetPlatform }} + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + targetPlatform: + - StandaloneWindows64 + - WebGL + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + lfs: true + + - name: Cache Unity Library + uses: actions/cache@v4 + with: + path: ${{ env.UNITY_PROJECT_PATH }}/Library + key: Library-${{ matrix.targetPlatform }}-${{ hashFiles(format('{0}/Assets/**', env.UNITY_PROJECT_PATH)) }} + restore-keys: | + Library-${{ matrix.targetPlatform }}- + Library- + + - name: Build Unity project + uses: game-ci/unity-builder@v4 + env: + UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} + UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} + UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} + with: + projectPath: ${{ env.UNITY_PROJECT_PATH }} + targetPlatform: ${{ matrix.targetPlatform }} + buildName: CommanderAILab + versioning: Semantic + + - name: Upload build artifact + uses: actions/upload-artifact@v4 + with: + name: Build-${{ matrix.targetPlatform }} + path: build/${{ matrix.targetPlatform }} + retention-days: 14