-
Notifications
You must be signed in to change notification settings - Fork 1
302 lines (251 loc) · 13.3 KB
/
updateSML.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
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
name: Check and update SatisfactoryModLoader
on:
workflow_dispatch:
inputs:
branch:
description: 'The game branch (EarlyAccess/Experimental)'
required: true
type: string
workflow_call:
inputs:
branch:
description: 'The game branch (EarlyAccess/Experimental)'
required: true
type: string
secrets:
WWISE_EMAIL:
required: true
WWISE_PASSWORD:
required: true
ACCESS_TOKEN:
required: false
jobs:
check:
runs-on: [self-hosted, project-updater]
outputs:
shouldRun: ${{ steps.setShouldRun.outputs.shouldRun }}
gameVersion: ${{ steps.setGameVersion.outputs.gameVersion }}
steps:
- name: Validate branch name
if: inputs.branch != 'EarlyAccess' && inputs.branch != 'Experimental'
run: |
echo "Invalid branch ${{ inputs.branch }}"
exit 1
- name: Cleanup
run: Remove-Item * -Recurse -Force -Confirm:$false -ErrorAction Ignore
- name: Download legendary
run: gh release download --repo derrod/legendary -p "legendary.exe"
env:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
- name: Download Satisfactory EarlyAccess version file
if: inputs.branch == 'EarlyAccess'
run: .\legendary.exe download CrabEA --no-https --base-path "$Env:GITHUB_WORKSPACE" --prefix="Engine/Binaries/Win64/FactoryGame-Win64-Shipping.version" --game-folder="Satisfactory" -y
- name: Download Satisfactory Experimental version file
if: inputs.branch == 'Experimental'
run: .\legendary.exe download CrabTest --no-https --base-path "$Env:GITHUB_WORKSPACE" --prefix="Engine/Binaries/Win64/FactoryGame-Win64-Shipping.version" --game-folder="Satisfactory" -y
- name: Read Satisfactory version
id: gameVersion
uses: notiz-dev/github-action-json-property@release
with:
path: 'Satisfactory/Engine/Binaries/Win64/FactoryGame-Win64-Shipping.version'
prop_path: 'Changelist'
- uses: actions/checkout@v3
with:
ref: 'refs/heads/${{ inputs.branch }}'
path: 'sfm'
repository: 'satisfactorymodding/UnrealProjectGenerator'
- name: Checkout SML
uses: actions/checkout@v3
with:
ref: 'refs/heads/auto-header-update'
path: 'SML'
repository: 'satisfactorymodding/SatisfactoryModLoader'
- name: Read current headers version
id: currentHeadersVersion
uses: juliangruber/read-file-action@v1
with:
path: 'sfm/Headers/currentVersion.txt'
- name: Read current headers version
id: currentSMLHeadersVersion
uses: juliangruber/read-file-action@v1
with:
path: 'SML/Source/FactoryGame/currentVersion.txt'
trim: true
- name: Set gameVersion
id: setGameVersion
run: echo "gameVersion=${{ steps.gameVersion.outputs.prop }}" >> $Env:GITHUB_OUTPUT
- name: Set shouldRun
id: setShouldRun
run: echo "shouldRun=${{ steps.gameVersion.outputs.prop > steps.currentSMLHeadersVersion.outputs.content && steps.gameVersion.outputs.prop == steps.currentHeadersVersion.outputs.content }}" >> $Env:GITHUB_OUTPUT
- name: Cleanup
run: Remove-Item * -Recurse -Force -Confirm:$false -ErrorAction Ignore
updateSML:
runs-on: [self-hosted, project-updater]
needs: check
if: needs.check.outputs.shouldRun == 'true'
steps:
- name: Validate branch name
if: inputs.branch != 'EarlyAccess' && inputs.branch != 'Experimental'
run: |
echo "Invalid branch ${{ inputs.branch }}"
exit 1
- name: Download legendary
run: gh release download --repo derrod/legendary -p "legendary.exe"
env:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
- name: Download jq
run: gh release download --repo stedolan/jq -p "jq-win64.exe"
env:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
- name: Download Satisfactory EarlyAccess
if: inputs.branch == 'EarlyAccess'
run: .\legendary.exe download CrabEA --no-https --base-path "$Env:GITHUB_WORKSPACE" --game-folder="Satisfactory" -y
- name: Download Satisfactory Experimental
if: inputs.branch == 'Experimental'
run: .\legendary.exe download CrabTest --no-https --base-path "$Env:GITHUB_WORKSPACE" --game-folder="Satisfactory" -y
- name: Checkout SML
uses: actions/checkout@v3
with:
ref: 'refs/heads/auto-header-update'
path: 'SML'
repository: 'satisfactorymodding/SatisfactoryModLoader'
token: ${{ secrets.ACCESS_TOKEN }}
- name: Checkout UnrealProjectGenerator
uses: actions/checkout@v3
with:
ref: 'refs/heads/${{ inputs.branch }}'
path: 'sfm'
repository: 'satisfactorymodding/UnrealProjectGenerator'
- name: Checkout satisfactory-modding-actions
uses: actions/checkout@v3
with:
path: 'satisfactory-modding-actions'
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1
- name: Setup Unreal Engine
uses: mircearoata/satisfactory-modding-ue-action@master
with:
token: ${{ secrets.ACCESS_TOKEN }}
- name: Copy latest game source
run: |
Remove-Item SML\Source\FactoryGame -Recurse -Force -Confirm:$false -ErrorAction Ignore
Remove-Item SML\Source\DummyHeaders -Recurse -Force -Confirm:$false -ErrorAction Ignore
cp sfm\FactoryGame\Source\FactoryGame SML\Source -Recurse
cp sfm\FactoryGame\Source\DummyHeaders SML\Source -Recurse
echo ${{ needs.check.outputs.gameVersion }} | Out-File SML\Source\FactoryGame\currentVersion.txt -Encoding utf8
- name: Add Wwise
run: |
gh release download --repo mircearoata/wwise-cli -p "wwise-cli.exe"
./wwise-cli.exe download --sdk-version "2022.1.5.8242" --filter Packages=SDK --filter DeploymentPlatforms=Windows_vc140 --filter DeploymentPlatforms=Windows_vc150 --filter DeploymentPlatforms=Windows_vc160 --filter DeploymentPlatforms=Windows_vc170 --filter DeploymentPlatforms=Linux --filter DeploymentPlatforms=
./wwise-cli.exe integrate-ue --integration-version "2022.1.5.2714" --project "SML\FactoryGame.uproject"
env:
WWISE_EMAIL: ${{ secrets.WWISE_EMAIL }}
WWISE_PASSWORD: ${{ secrets.WWISE_PASSWORD }}
- name: Checkout UEAssetToolkit
uses: actions/checkout@v3
with:
ref: 'refs/heads/dev'
path: 'UEAssetToolkit'
repository: 'mircearoata/UEAssetToolkit'
- name: Replace SML with hooks-only version
run: |
mv SML\Mods Mods_TEMP
cp satisfactory-modding-actions\SML_HooksOnly SML\Mods -Recurse
- name: Copy UEAssetToolkit to project
run: |
cp UEAssetToolkit\\AssetDumper SML\\Mods -Recurse
cp UEAssetToolkit\\AssetGenerator SML\\Mods -Recurse
- name: Compile project
run: |
& "$Env:UE_ROOT\\Engine\\Build\\BatchFiles\\Build.bat" -projectfiles -project="$Env:GITHUB_WORKSPACE\\SML\\FactoryGame.uproject" -game -rocket -progres
MSBuild.exe .\\SML\\FactoryGame.sln /p:Configuration="Shipping" /p:Platform="Win64" /t:"Games\FactoryGame"
MSBuild.exe .\\SML\\FactoryGame.sln /p:Configuration="Development Editor" /p:Platform="Win64" /t:"Games\FactoryGame"
- name: Set SML BuildId
run: |
.\jq-win64.exe -r '.BuildId = ""SML""' SML\\Mods\\SML\\Binaries\\Win64\\FactoryGame-Win64-Shipping.modules > FactoryGame-Win64-Shipping.modules
rm SML\\Mods\\SML\\Binaries\\Win64\\FactoryGame-Win64-Shipping.modules
mv FactoryGame-Win64-Shipping.modules SML\\Mods\\SML\\Binaries\\Win64
- name: Set AssetDumper BuildId
run: |
.\jq-win64.exe -r '.BuildId = ""SML""' SML\\Mods\\AssetDumper\\Binaries\\Win64\\FactoryGame-Win64-Shipping.modules > FactoryGame-Win64-Shipping.modules
rm SML\\Mods\\AssetDumper\\Binaries\\Win64\\FactoryGame-Win64-Shipping.modules
mv FactoryGame-Win64-Shipping.modules SML\\Mods\\AssetDumper\\Binaries\\Win64
- name: Copy SML to game
run: cp SML\\Mods\\SML Satisfactory\\FactoryGame\\Mods\\SML -Recurse
- name: Copy AssetDumper to game
run: cp SML\\Mods\\AssetDumper Satisfactory\\FactoryGame\\Mods\\AssetDumper -Recurse
- name: Run game and dump assets
run: Start-Process .\\Satisfactory\\Engine\\Binaries\\Win64\\FactoryGame-Win64-Shipping.exe -ArgumentList "-EpicPortal -nullrhi -DumpAllGameAssets -RootAssetPath=/Game -ExcludePackagePaths=/Game/WwiseAudio -ExcludePackageNames=/Game/Geometry/Meshes/1M_Cube_Chamfer -PackagesPerTick=32 -ExitOnFinish" -NoNewWindow -Wait
- name: Dump configs from pak file
run: |
& "$Env:UE_ROOT\\Engine\\Binaries\\Win64\\UnrealPak.exe" -Extract "$Env:GITHUB_WORKSPACE\\Satisfactory\\FactoryGame\\Content\\Paks\\FactoryGame-Windows.pak" "$Env:GITHUB_WORKSPACE\\SatisfactoryPak" -Filter="FactoryGame/Config/*.ini"
- name: Update CollisionProfiles
run: |
$pakEngineIniPath = Resolve-Path -Path 'SatisfactoryPak\\FactoryGame\\Config\\DefaultEngine.ini'
$projectEngineIniPath = Resolve-Path -Path 'SML\\Config\\DefaultEngine.ini'
$options = [Text.RegularExpressions.RegexOptions]'Multiline,Singleline'
$collisionProfilesRegex = '^\[\/Script\/Engine\.CollisionProfile\].+?$(?=\r?\n\[)'
$pakEngineIni = Get-Content $pakEngineIniPath -Encoding UTF8 -Raw
$projectEngineIni = Get-Content $projectEngineIniPath -Encoding UTF8 -Raw
$newCollisionProfiles = [regex]::Match($pakEngineIni, $collisionProfilesRegex, $options)
$newProjectEngineIni = [regex]::Replace($projectEngineIni, $collisionProfilesRegex, $newCollisionProfiles.Value, $options)
# Out-File would use UTF8-BOM
[System.IO.File]::WriteAllText($projectEngineIniPath, $newProjectEngineIni)
- name: Restore SMLEditor utils folder
run: |
cp Mods_TEMP\SMLEditor\Content\Utils SML\Mods\SMLEditor\Content\Utils -Recurse
- name: Run asset generator
run: |
& "$Env:UE_ROOT\\Engine\\Binaries\\Win64\\UnrealEditor-Cmd.exe" "$Env:GITHUB_WORKSPACE\\SML\\FactoryGame.uproject" -run=AssetGenerator -DumpDirectory="$Env:GITHUB_WORKSPACE\\Satisfactory\\FactoryGame\\AssetDump" -ForceGeneratePackageNames="$Env:GITHUB_WORKSPACE\\satisfactory-modding-actions\\ForceGeneratePackages.txt" -SkipSavePackages="$Env:GITHUB_WORKSPACE\\satisfactory-modding-actions\\SkipSavePackages.txt" -PublicProject -stdout -unattended -NoLogTimes
- name: Remove outdated assets
run: |
& "$Env:UE_ROOT\\Engine\\Binaries\\Win64\\UnrealPak.exe" -List -csv="$Env:GITHUB_WORKSPACE\\pakContents.csv" -LogCmds="LogPakFile Warning" $Env:GITHUB_WORKSPACE\\Satisfactory\\FactoryGame\\Content\\Paks\\FactoryGame-Windows.pak
$pakData = Import-Csv .\pakContents.csv
$pakFiles = $pakData | ForEach-Object { $_.Filename }
$files = @()
$prefix = "FactoryGame/Content/"
foreach ($file in $pakFiles) {
$filename = $file
if ($filename.StartsWith($prefix)) {
$filename = $filename.Substring($prefix.length)
$files += ($Env:GITHUB_WORKSPACE + "\SML\Content\" + $filename).replace('/', '\')
}
}
dir -rec SML\Content\*.* | Where-Object { $files -notcontains $_.Fullname } | Remove-Item
- name: Revert handmade assets
run: |
$customAssets = Get-Content .\\satisfactory-modding-actions\\CustomAssets.txt
cd SML
$customAssets | Foreach-Object { git checkout Content/$_ }
- name: Undo "Replace SML with hooks-only version"
run: |
rm -r SML\Mods
mv Mods_TEMP SML\Mods
- name: Update SML GameVersion
run: |
$RawString = .\jq-win64.exe -r '.GameVersion = ""${{ needs.check.outputs.gameVersion }}""' --tab SML\\Mods\\SML\\SML.uplugin
$Utf8NoBomEncoding = New-Object System.Text.UTF8Encoding $False
[System.IO.File]::WriteAllLines("SML.uplugin", $RawString, $Utf8NoBomEncoding)
rm SML\\Mods\\SML\\SML.uplugin
mv SML.uplugin SML\\Mods\\SML
- name: Commit and push
working-directory: SML
run: |
git rm -r --cached Source Content
git add Source Content
git add Config/DefaultEngine.ini
git commit -m "Automated update to CL${{ needs.check.outputs.gameVersion }}"
git push
- name: Archive asset dump
if: always()
run: 7z a AssetDump.7z Satisfactory\FactoryGame\AssetDump
- name: Store asset dump
if: always()
uses: actions/upload-artifact@v3
with:
name: AssetDump
path: |
AssetDump.7z
retention-days: 7
- name: Cleanup
run: Remove-Item * -Recurse -Force -Confirm:$false -ErrorAction Ignore