-
Notifications
You must be signed in to change notification settings - Fork 4
171 lines (144 loc) · 6.35 KB
/
build-dev-mac.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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
name: Builds - Mac (development)
on:
repository_dispatch:
types: [new_edge_build]
workflow_dispatch:
schedule:
- cron: '25 0,12 * * *'
concurrency:
group: mac-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
platform: "MacOS"
unityVersion: "2021.3.21f1"
unityVersionHash: "1b156197d683"
permissions:
contents: write
jobs:
check:
name: "Check for releases"
runs-on: ubuntu-latest
outputs:
runBuild: ${{ steps.check-latest-output.outputs.runBuild }}
messageBody: ${{ steps.check-latest-output.outputs.messageBody }}
steps:
- name: "Checkout"
uses: actions/checkout@v3
- name: "Setup Node"
uses: actions/setup-node@v3
with:
node-version: latest
cache: npm
- name: "Install dependencies"
run: npm i
- name: "Check for latest release / Save information to output"
id: check-latest-output
run: node methods/CheckLatestRelease.js
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PLATFORM: ${{ env.platform }}
macBuilder:
name: Mac Build
needs: [check]
if: needs.check.outputs.runBuild == 'true'
runs-on: macos-latest
timeout-minutes: 90
steps:
###########################
# Checkout #
###########################
- name: "[Pre-install] Pull project"
uses: nschloe/[email protected]
with:
repository: YARC-Official/YARG
ref: dev
- name: "[Pre-install] Save commit sha into output"
id: latestCommit
run: |
echo "commitSHA=$(git show-ref | grep refs/remotes/origin/dev | cut -c1-40)" >> "$GITHUB_OUTPUT" &&
echo "commitShortSHA=$(git show-ref | grep refs/remotes/origin/dev | cut -c1-7)" >> "$GITHUB_OUTPUT"
- name: "[Pre-install] Pull bleeding-edge repo"
uses: actions/checkout@v3
with:
repository: ${{ github.repository }}
path: bleedingedge
###########################
# Cache #
###########################
- name: "[Pre-install] Restore 'library' cache"
uses: actions/cache@v3
with:
path: Library
key: YARG-Library-MacOS-Development
restore-keys: |
YARG-Library-MacOS-
###########################
# Install Blender #
###########################
- name: "[Pre-install] Get Blender (3.4.1) from cache"
id: blender
uses: actions/cache@v3
with:
path: ${{ runner.temp }}/BlenderInstall
key: mac-blender-3.4.1
restore-keys: mac-blender-
- if: ${{ steps.blender.outputs.cache-hit != 'true' }}
name: "[Pre-install] Download Blender (3.4.1)"
continue-on-error: true
run: mkdir ${{ runner.temp }}/BlenderInstall && curl -L -o "${{ runner.temp }}/BlenderInstall/blender.dmg" https://download.blender.org/release/Blender3.4/blender-3.4.1-macos-x64.dmg
# - name: "[Pre-install] Install Blender"
# run: brew install --cask blender
- name: "[Pre-install] Install Blender (3.4.1)"
run: >
hdiutil attach ${{ runner.temp }}/BlenderInstall/blender.dmg &&
cp -R /Volumes/Blender/Blender.app /Applications &&
hdiutil unmount /Volumes/Blender
###########################
# Restore Packages #
###########################
- name: "[Pre-install] Restoring NuGet Packages"
run: dotnet tool install --global NuGetForUnity.Cli && nugetforunity restore
###########################
#Replace icon with nightly#
###########################
- name: "[Pre-build] Replace icon with Nightly/Development"
shell: bash
run: "cp -f bleedingedge/static/Icon_Nightly.png Assets/Art/UI/Icon_Stable.png"
###########################
# Build #
###########################
- name: "[Install] Download Unity Editor + Mac IL2CPP builder"
run: |
mkdir ${{ runner.temp }}/UnityInstall &&
curl -L -o "${{ runner.temp }}/UnityInstall/UnitySetup-Editor.pkg" https://download.unity3d.com/download_unity/${{ env.unityVersionHash }}/MacEditorInstaller/Unity-${{ env.unityVersion }}.pkg &&
curl -L -o "${{ runner.temp }}/UnityInstall/UnitySetup-Mac-IL2CPP-Support.pkg" https://download.unity3d.com/download_unity/${{ env.unityVersionHash }}/MacEditorTargetInstaller/UnitySetup-Mac-IL2CPP-Support-for-Editor-${{ env.unityVersion }}.pkg
- name: "[Install] Install Unity Editor + Mac IL2CPP builder"
run: |
sudo installer -pkg "${{ runner.temp }}/UnityInstall/UnitySetup-Editor.pkg" -target "/" -verbose &&
sudo installer -pkg "${{ runner.temp }}/UnityInstall/UnitySetup-Mac-IL2CPP-Support.pkg" -target "/" -verbose &&
rm -rf "${{ runner.temp }}/UnityInstall"
- name: "[Build] Run Builder"
run: |
/Applications/Unity/Unity.app/Contents/MacOS/Unity -quit -batchmode -nographics -projectPath ${{ github.workspace }} -buildTarget StandaloneOSX -buildOSXUniversalPlayer ${{ github.workspace }}/build/YARG.app -username ${{ secrets.MAC_UNITY_EMAIL || secrets.UNITY_EMAIL }} -password ${{ secrets.MAC_UNITY_PASSWORD || secrets.UNITY_PASSWORD }} -serial ${{ secrets.MAC_UNITY_SERIAL || secrets.UNITY_SERIAL }} -logfile -
###########################
# Compress #
###########################
- name: "[Post-build] Compress to a .zip"
run: ditto -c -k --keepParent build/YARG.app Release/YARG_${{ steps.latestCommit.outputs.commitSHA }}-MacOS-Universal.zip
###########################
# Upload #
###########################
# - name: "[Post-build] Upload to artifacts"
# uses: actions/upload-artifact@v3
# with:
# name: MacOS Universal
# path: Release
- name: "[Post-build] Upload to releases"
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
release_name: Nightly Build - ${{ steps.latestCommit.outputs.commitSHA }}
tag: ${{ steps.latestCommit.outputs.commitShortSHA }}
file: Release/*
file_glob: true
body: ${{ needs.check.outputs.messageBody }}