-
Notifications
You must be signed in to change notification settings - Fork 0
136 lines (128 loc) · 4.24 KB
/
build.yml
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
name: Build
on:
pull_request:
workflow_dispatch:
inputs:
clean:
type: boolean
default: false
description: "clean"
env:
CLEAN: ${{ github.event.inputs.clean || false }}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
paths-filter:
name: Paths Filter
runs-on: ubuntu-latest
outputs:
should-build: ${{ steps.filter.outputs.should-build }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
should-build:
- Assets/**/*
- ProjectSettings/**/*
- Packages/**/*
- .github/workflows/build.yml
get-unity-version:
name: Get Unity Version
needs: paths-filter
if: ${{ (github.event_name == 'pull_request' && needs.paths-filter.outputs.should-build == 'true') || github.event_name == 'workflow_dispatch'}}
runs-on: ubuntu-latest
outputs:
unity-version: ${{ steps.get-unity-version.outputs.unity-version }}
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: ProjectSettings/ProjectVersion.txt
clean: "${{ env.CLEAN }}"
- name: Get Unity version
id: get-unity-version
run: |
echo "unity-version=$(grep "m_EditorVersion:" < ProjectSettings/ProjectVersion.txt | cut -d" " -f2)" >> "${GITHUB_OUTPUT}"
android:
name: Android
needs: get-unity-version
runs-on: [self-hosted, macOS]
steps:
- name: Switch workspace
uses: DeNA/setup-job-workspace-action@fea4ef4d011492fe235833241acbb4fced82da27
- uses: actions/checkout@v4
with:
clean: "${{ env.CLEAN }}"
- name: Android Build
env:
UNITY_VERSION: ${{ needs.get-unity-version.outputs.unity-version }}
ANDROID_NDK_ROOT: "/Applications/Unity/Hub/Editor/${UNITY_VERSION}/PlaybackEngines/AndroidPlayer/NDK"
run: |
/Applications/Unity/Hub/Editor/"${UNITY_VERSION}"/Unity.app/Contents/MacOS/Unity \
-quit \
-batchmode \
-nographics \
-projectPath "$(pwd)" \
-executeMethod Editor.BuildEntryPoint.BuildAndroid
ios:
name: iOS
needs: get-unity-version
runs-on: [self-hosted, macOS]
steps:
- name: Switch workspace
uses: DeNA/setup-job-workspace-action@fea4ef4d011492fe235833241acbb4fced82da27
- uses: actions/checkout@v4
with:
clean: "${{ env.CLEAN }}"
- name: iOS Build
env:
UNITY_VERSION: ${{ needs.get-unity-version.outputs.unity-version }}
run: |
/Applications/Unity/Hub/Editor/"${UNITY_VERSION}"/Unity.app/Contents/MacOS/Unity \
-quit \
-batchmode \
-nographics \
-projectPath "$(pwd)" \
-executeMethod Editor.BuildEntryPoint.BuildIOS
macos:
name: macOS
needs: get-unity-version
runs-on: [self-hosted, macOS]
steps:
- name: Switch workspace
uses: DeNA/setup-job-workspace-action@fea4ef4d011492fe235833241acbb4fced82da27
- uses: actions/checkout@v4
with:
clean: "${{ env.CLEAN }}"
- name: macOS Build
env:
UNITY_VERSION: ${{ needs.get-unity-version.outputs.unity-version }}
run: |
/Applications/Unity/Hub/Editor/"${UNITY_VERSION}"/Unity.app/Contents/MacOS/Unity \
-quit \
-batchmode \
-nographics \
-projectPath "$(pwd)" \
-executeMethod Editor.BuildEntryPoint.BuildMacOS
webgl:
name: WebGL
needs: get-unity-version
runs-on: [self-hosted, macOS]
steps:
- name: Switch workspace
uses: DeNA/setup-job-workspace-action@fea4ef4d011492fe235833241acbb4fced82da27
- uses: actions/checkout@v4
with:
clean: "${{ env.CLEAN }}"
- name: WebGL Build
env:
UNITY_VERSION: ${{ needs.get-unity-version.outputs.unity-version }}
run: |
/Applications/Unity/Hub/Editor/"${UNITY_VERSION}"/Unity.app/Contents/MacOS/Unity \
-quit \
-batchmode \
-nographics \
-projectPath "$(pwd)" \
-executeMethod Editor.BuildEntryPoint.BuildWebGL