|
27 | 27 | UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }} |
28 | 28 | UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} |
29 | 29 | UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} |
30 | | - with: |
31 | | - buildMethod: UnityEditor.SyncVS.SyncSolution |
| 30 | + |
| 31 | + - name: Find Unity Editor |
| 32 | + run: | |
| 33 | + set -e |
| 34 | +
|
| 35 | + # Common Unity Editor locations when using game-ci |
| 36 | + POSSIBLE_LOCATIONS=( |
| 37 | + "/opt/unity-editor/Editor/Unity" |
| 38 | + "/opt/unity/Editor/Unity" |
| 39 | + "/opt/Unity/Editor/Unity" |
| 40 | + "/usr/bin/unity-editor" |
| 41 | + "$HOME/Unity/Hub/Editor" # If Unity Hub is present |
| 42 | + ) |
| 43 | +
|
| 44 | + # Search for the Unity executable |
| 45 | + UNITY_PATH="" |
| 46 | + for path in "${POSSIBLE_LOCATIONS[@]}"; do |
| 47 | + if [[ -x "$path" ]]; then |
| 48 | + UNITY_PATH="$path" |
| 49 | + break |
| 50 | + fi |
| 51 | + done |
| 52 | +
|
| 53 | + # If Unity was installed via Unity Hub, find the latest installed version |
| 54 | + if [[ -d "$HOME/Unity/Hub/Editor" && -z "$UNITY_PATH" ]]; then |
| 55 | + UNITY_PATH=$(find "$HOME/Unity/Hub/Editor" -maxdepth 2 -name "Unity" -type f -executable | sort -V | tail -n 1) |
| 56 | + fi |
| 57 | +
|
| 58 | + # Output the result |
| 59 | + if [[ -z "$UNITY_PATH" ]]; then |
| 60 | + echo "Unity Editor not found!" >&2 |
| 61 | + exit 1 |
| 62 | + else |
| 63 | + echo "Unity Editor found at: $UNITY_PATH" |
| 64 | + echo "UNITY_PATH=$UNITY_PATH" >> $GITHUB_ENV |
| 65 | + fi |
| 66 | +
|
| 67 | +
|
| 68 | + - name: Generate Solution Files |
| 69 | + run: | |
| 70 | + unity-editor -batchmode -quit -nographics -logFile -executeMethod UnityEditor.SyncVS.SyncSolution |
| 71 | +
|
| 72 | +
|
| 73 | +
|
| 74 | + - name: List Generated Files (Debugging) |
| 75 | + run: ls -la |
32 | 76 |
|
33 | 77 | - name: Upload Solution Files |
34 | 78 | uses: actions/upload-artifact@v4 |
|
0 commit comments