FIx CI #17
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Unity Build | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| jobs: | |
| check-license: | |
| name: Check Unity license secrets | |
| runs-on: ubuntu-latest | |
| outputs: | |
| available: ${{ steps.check.outputs.available }} | |
| steps: | |
| - name: Detect license secrets | |
| id: check | |
| env: | |
| UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} | |
| UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} | |
| UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} | |
| run: | | |
| if [ -n "$UNITY_LICENSE" ] && [ -n "$UNITY_EMAIL" ] && [ -n "$UNITY_PASSWORD" ]; then | |
| echo "available=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "available=false" >> "$GITHUB_OUTPUT" | |
| echo "Unity license secrets are not configured; skipping builds." | |
| fi | |
| build: | |
| name: Build ${{ matrix.project }} | |
| needs: check-license | |
| if: needs.check-license.outputs.available == 'true' | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| project: | |
| - unity-quick-start | |
| - unity-auth0-example | |
| - unity-aggregate-verifier-example | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| lfs: true | |
| - name: Cache Library folder | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ matrix.project }}/Library | |
| key: Library-${{ matrix.project }}-${{ hashFiles(format('{0}/Assets/**', matrix.project), format('{0}/Packages/**', matrix.project), format('{0}/ProjectSettings/**', matrix.project)) }} | |
| restore-keys: | | |
| Library-${{ matrix.project }}- | |
| Library- | |
| - name: Build 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: ${{ matrix.project }} | |
| unityVersion: 6000.3.22f1 | |
| targetPlatform: StandaloneWindows64 | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: Build-${{ matrix.project }}-StandaloneWindows64 | |
| path: build/StandaloneWindows64 |