Unity Build #20
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
| # File: .github/workflows/unity-build.yml | |
| name: Unity Build | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| pull_request: | |
| branches: [ "main" ] | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # 1. Checkout the repository to the runner | |
| - name: Checkout project | |
| uses: actions/checkout@v4 | |
| # 2. Automatically get the Unity version from the project settings | |
| - 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. Perform the build using GameCI's builder action | |
| - name: Unity - Build | |
| uses: game-ci/unity-builder@v4 | |
| env: | |
| UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} | |
| with: | |
| targetPlatform: WebGL # Or your desired platform | |
| # ... other options | |
| # 4. (Optional) Upload the build artifact so you can download it | |
| - name: Upload Build Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| # Updated artifact name for the web build | |
| name: build-WebGL | |
| # Updated path to the WebGL build folder | |
| path: build/WebGL |