Unity Build #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: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # 1. Checkout project | |
| - name: Checkout project | |
| uses: actions/checkout@v3 | |
| # 2. Get Unity Version from ProjectSettings/ProjectVersion.txt | |
| - 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. Build the project | |
| # This single step now handles activation and building | |
| - name: Unity - Build | |
| uses: game-ci/unity-builder@v4 | |
| env: | |
| UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} | |
| UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} | |
| UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} | |
| with: | |
| unityVersion: ${{ steps.get-unity-version.outputs.version }} | |
| targetPlatform: Android # Or whatever platform you need | |
| # (Optional) 4. Upload build artifact | |
| - name: Upload Build Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: build-${{ steps.build.outputs.buildPath }} | |
| path: ${{ steps.build.outputs.buildPath }} |