tfy #15
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" ] # Run on push to main | |
| pull_request: | |
| branches: [ "main" ] # Run on PRs targeting main | |
| workflow_dispatch: # Allow manual run from Actions tab | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # 1. Checkout project | |
| - uses: actions/checkout@v3 | |
| # 2. Detect Unity version | |
| - name: Get Unity Version | |
| id: get-unity-version | |
| run: | | |
| version=$(grep "^m_EditorVersion:" ProjectSettings/ProjectVersion.txt | sed 's/m_EditorVersion: //') | |
| echo "version=$version" >> $GITHUB_OUTPUT | |
| # 3. Request activation file (first run only) | |
| - name: Unity - Request Activation File | |
| uses: game-ci/unity-request-activation-file@v2 | |
| with: | |
| unityVersion: ${{ steps.get-unity-version.outputs.version }} | |
| - name: Upload activation file | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: Unity_ActivationFile | |
| path: Unity_*.alf | |
| # 4. Activate (after you upload UNITY_LICENSE secret from .ulf file) | |
| - name: Unity - Activate | |
| if: env.UNITY_LICENSE != '' | |
| uses: game-ci/unity-activate@v2 | |
| with: | |
| unityVersion: ${{ steps.get-unity-version.outputs.version }} | |
| env: | |
| UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} | |
| # 5. Build | |
| - name: Unity - Build | |
| uses: game-ci/unity-builder@v4 | |
| with: | |
| unityVersion: ${{ steps.get-unity-version.outputs.version }} | |
| targetPlatform: Android # Change to WebGL, StandaloneWindows, iOS, etc. |