-
Notifications
You must be signed in to change notification settings - Fork 6
238 lines (198 loc) · 8.77 KB
/
build-plugin.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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
#### Secrets #####
# Requires "UNREAL_CI_PAT" to be defined with an access token from a github account that has access to the UnrealEngine source code
#### Runner requirements ####
## macOS ##
# 1. A valid Xcode environment with macOS and iOS SDKs
# 2. brew
## Windows/Android/Linux ##
# 1. Visual Studio 2022
# 2. Android NDK setup: https://docs.unrealengine.com/5.3/en-US/how-to-set-up-android-sdk-and-ndk-for-your-unreal-engine-development-environment/
# 3. Linux cross-compile toolchain: https://docs.unrealengine.com/5.3/en-US/linux-development-requirements-for-unreal-engine/ ; We could use another linux runner, but it'll save quite a bit of time to just cross compile to linux instead of having to build yet-another UE build
name: Build Plugin
on:
workflow_dispatch:
inputs:
ENGINE_VERSION:
type: string
description: Unreal Engine Release Version
default: "5.3.2"
REF:
type: string
description: Branch or ref to build plugin source from
default: "main"
push:
tags:
- "*"
jobs:
build-plugin-apple:
runs-on: [self-hosted, macOS]
steps:
# grab a small cli json parser
- name: setup
run: |
brew install jq
# checkout rive-unreal
- uses: actions/checkout@v2
with:
clean: true
lfs: true
repository: "rive-app/rive-unreal"
path: "RiveUnreal"
ref: "${{inputs.REF}}"
# lfs
- name: pull lfs because checkout doesnt
run: |
git lfs pull
working-directory: RiveUnreal
# required for hooks on macOS
- name: Make library/services in our temp directory, required for post checkout hook FixDependencyFiles.sh for macOS
run: |
mkdir -p "${{runner.temp}}/Library/Services"
echo "${{runner.temp}}/Library/Services"
ls -al "${{runner.temp}}/Library/Services"
# grab UE5 of our input version
- name: Clone UE5 Source
uses: actions/checkout@v2
with:
repository: "EpicGames/UnrealEngine" # Adjust if using a fork
ref: "${{inputs.ENGINE_VERSION}}-release"
path: UE-${{inputs.ENGINE_VERSION}}
token: ${{ secrets.UNREAL_CI_PAT }} # Ensure you have access to UE5 repo
clean: false
fetch-depth: 1
continue-on-error: true
# ensure we have UE5
- name: Check if UE source successfully got fetched, we expect the previous checkout to fail due to UE posthook to FixDependencyFiles.sh using the ~ token to copy to Library/Services that doesnt exist in our environment
run: |
if [ ! -d "${{github.workspace}}/UE-${{inputs.ENGINE_VERSION}}" ]; then
echo "Did not successfully checkout UE source"
exit 1
fi
# We just need to use Setup and Generate, as we don't actually need to build here, we can let the BuildPlugin step do the work for us, as it will determine what needs to be built
- name: Build UE5
run: |
./Setup.sh
./GenerateProjectFiles.sh
# xcodebuild -workspace UE5.xcworkspace -scheme "UnrealEditor" -sdk macosx
working-directory: UE-${{inputs.ENGINE_VERSION}}
- name: Version info
run: |
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
version=${GITHUB_REF#refs/tags/}
else
version=${GITHUB_SHA}
fi
echo "Setting VersionName to $version"
echo "RIVE_VERSION=$version" >> $GITHUB_ENV
upluginPath="${GITHUB_WORKSPACE}/RiveUnreal/Rive.uplugin"
# Read the .uplugin file and parse it as JSON, update VersionName, and save
jq '.VersionName = "'$version'"' "$upluginPath" > temp.json && mv temp.json "$upluginPath"
- name: Build Plugin macOS arm64
run: |
./Engine/Build/BatchFiles/RunUAT.sh -Verbose BuildPlugin -Plugin="${{github.workspace}}/RiveUnreal/Rive.uplugin" -Package="${{github.workspace}}/RiveUnreal/Output/Apple" -precompile -TargetPlatforms=Mac+IOS -Architecture_Mac=arm64
working-directory: UE-${{inputs.ENGINE_VERSION}}
- name: Build Plugin macOS x64
run: |
./Engine/Build/BatchFiles/RunUAT.sh -Verbose BuildPlugin -Plugin="${{github.workspace}}/RiveUnreal/Rive.uplugin" -Package="${{github.workspace}}/RiveUnreal/Output/x64" -precompile -TargetPlatforms=Mac -Architecture_Mac=x64
working-directory: UE-${{inputs.ENGINE_VERSION}}
- name: Copy x64 intermediates
run: |
cp -r "${{github.workspace}}/RiveUnreal/Output/x64/Intermediate/Build/Mac/x64" "${{github.workspace}}/RiveUnreal/Output/Apple/Intermediate/Build/Mac/"
- name: Upload macOS + iOS Artifacts
uses: actions/upload-artifact@v2
with:
name: RiveUnreal-${{ env.RIVE_VERSION }}-ue-${{ inputs.ENGINE_VERSION }}-apple
path: RiveUnreal/Output/Apple
# build windows, android
build-plugin-allelse:
runs-on: [self-hosted, Windows]
steps:
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v2
- uses: actions/checkout@v2
with:
clean: true
lfs: true
repository: "rive-app/rive-unreal"
path: "RiveUnreal"
ref: "${{inputs.REF}}"
- name: pull lfs because checkout doesnt
run: |
git lfs pull
working-directory: RiveUnreal
- name: Clone UE5 Source
uses: actions/checkout@v2
with:
repository: "EpicGames/UnrealEngine" # Adjust if using a fork
ref: "${{inputs.ENGINE_VERSION}}-release"
path: UE-${{inputs.ENGINE_VERSION}}
token: ${{ secrets.UNREAL_CI_PAT }} # Ensure you have access to UE5 repo
clean: false
- name: Build UE5
run: |
.\Setup.bat
.\GenerateProjectFiles.bat
# msbuild UE5.sln /p:"Configuration=Development Editor" /p:Platform=Win64 /m
working-directory: UE-${{inputs.ENGINE_VERSION}}
- name: Version info
run: |
if("${{ github.ref }}" -match "^refs/tags/") {
$version = "${{ github.ref }}".Replace("refs/tags/", "")
} else {
$version = "${{ github.sha }}"
}
Write-Host "Setting VersionName to $version"
echo "RIVE_VERSION=$version" | Out-File -FilePath $env:GITHUB_ENV -Append
$upluginPath = "${{github.workspace}}/RiveUnreal/Rive.uplugin"
# Read the .uplugin file and parse it as JSON
$upluginContent = Get-Content $upluginPath | Out-String | ConvertFrom-Json
# Update the VersionName
$upluginContent.VersionName = $version
# Convert back to JSON and save
$upluginContent | ConvertTo-Json -Depth 100 | Set-Content $upluginPath
- name: Build Win64 and Android Plugin
run: |
.\Engine\Build\BatchFiles\RunUAT.bat -Verbose BuildPlugin -Plugin="${{github.workspace}}/RiveUnreal/Rive.uplugin" -Package="${{github.workspace}}/RiveUnreal/Output" -precompile -TargetPlatforms=Win64+Android
working-directory: UE-${{inputs.ENGINE_VERSION}}
- name: Remove PDB files
run: |
Get-ChildItem "${{github.workspace}}/RiveUnreal/Output/Binaries/*.pdb" -Recurse | Remove-Item
- name: Upload Artifacts
uses: actions/upload-artifact@v2
with:
name: RiveUnreal-${{ env.RIVE_VERSION }}-ue-${{ inputs.ENGINE_VERSION}}
path: RiveUnreal/Output
combine-binaries:
needs: [build-plugin-apple, build-plugin-allelse]
runs-on: ubuntu-latest
steps:
- name: Version info
run: |
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
version=${GITHUB_REF#refs/tags/}
else
version=${GITHUB_SHA}
fi
echo "Setting VersionName to $version"
echo "RIVE_VERSION=$version" >> $GITHUB_ENV
- name: Download all artifacts
uses: actions/download-artifact@v2
with:
path: artifacts/
- name: Print folder
run: |
ls -al artifacts
ls -al artifacts/RiveUnreal-${{ env.RIVE_VERSION }}-ue-${{ inputs.ENGINE_VERSION}}/Binaries
ls -al artifacts/RiveUnreal-${{ env.RIVE_VERSION }}-ue-${{ inputs.ENGINE_VERSION}}/Intermediate/Build
- name: Combine
run: |
cp -r ./artifacts/RiveUnreal-${{ env.RIVE_VERSION }}-ue-${{ inputs.ENGINE_VERSION}}-apple/* ./artifacts/RiveUnreal-${{ env.RIVE_VERSION }}-ue-${{ inputs.ENGINE_VERSION}}/
- name: Zip
run: |
cd "artifacts/RiveUnreal-${{ env.RIVE_VERSION }}-ue-${{ inputs.ENGINE_VERSION}}"
zip -r ../../RiveUnreal-${{ env.RIVE_VERSION }}.zip .
- name: Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: RiveUnreal-${{ env.RIVE_VERSION }}.zip