-
Notifications
You must be signed in to change notification settings - Fork 11
64 lines (53 loc) · 1.88 KB
/
Copy pathunity-build.yml
File metadata and controls
64 lines (53 loc) · 1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
name: Unity Build with Cake (Android)
on:
push:
branches:
- '**'
jobs:
build:
if: contains(github.event.head_commit.message, '#build')
runs-on: ubuntu-latest
container:
image: ghcr.io/sinlessdevil/unity-ci-image:2023.2.1f1
credentials:
username: ${{ secrets.USERNAME }}
password: ${{ secrets.CR_PAT }}
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
steps:
- name: 🧾 Checkout Repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: 💾 Cache Unity Library
uses: actions/cache@v4
with:
path: Library
key: Library-${{ runner.os }}-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }}
restore-keys: |
Library-${{ runner.os }}-
- name: 🪪 Activate Unity Pro License (.ulf)
run: |
mkdir -p /root/.local/share/unity3d/Unity
echo "${UNITY_LICENSE}" | base64 -d > /root/.local/share/unity3d/Unity/Unity_lic.ulf
echo "✅ License file written to /root/.local/share/unity3d/Unity/Unity_lic.ulf"
- name: 🛠️ Build APK via Unity
run: |
echo "🔧 Starting Unity build..."
/opt/unity/Unity/Unity \
-batchmode -nographics -quit \
-projectPath . \
-executeMethod Plugins.CI.Editor.Builder.BuildAndroidAPK_Dev \
-logFile /root/unity.log || echo "❌ Unity crashed"
echo "------ UNITY LOG ------"
cat /root/unity.log || echo "❌ Unity log not found"
- name: 🧪 Run Cake pipeline (tests, logs)
run: |
dotnet tool restore
dotnet cake build.cake --target=Run-CI-Pipeline
- name: 📤 Upload APK Artifact
if: success()
uses: actions/upload-artifact@v4
with:
name: AndroidBuild
path: artifacts/*.apk