forked from Eloquence4/QuickLootEE
-
Notifications
You must be signed in to change notification settings - Fork 8
388 lines (344 loc) · 13.4 KB
/
build-release.yml
File metadata and controls
388 lines (344 loc) · 13.4 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
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
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
name: Build Release
on:
schedule:
- cron: '0 0 * * *'
push:
branches:
- "main"
paths-ignore:
- '*.yaml'
- '*.txt'
- '*.md'
workflow_dispatch:
inputs:
version:
description: 'Release version (defaults to "Nightly" & always appends run ID)'
required: false
default: 'Nightly'
publish-release:
description: 'Publish Release?'
type: boolean
default: true
release-body:
description: 'Release body'
required: false
default: 'Latest nightly of QuickLootIE. These builds are untested and may contain bugs.'
spriggit_tool_version:
description: 'Spriggit version (optional)'
required: false
jobs:
prepare:
name: Prepare and Check Changes
runs-on: ubuntu-latest
outputs:
date: ${{ steps.get-date.outputs.time }}
version: ${{ steps.get-version.outputs.VERSION }}
should_run: ${{ steps.should_run.outputs.should_run }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Get Date
id: get-date
uses: Kaven-Universe/github-action-current-date-time@v1
with:
format: "YYYY-MM-DD"
- name: Get version
id: get-version
shell: bash
run: echo "VERSION=${{ inputs.version || format('nightly-{0}', steps.get-date.outputs.time) }}" >> "$GITHUB_OUTPUT"
- name: Check for changes last 24 hours
id: should_run
shell: bash
run: |
git log --since="1 days ago" --name-only
echo "should_run=$(git log --since="1 days ago" --name-only | grep "" -c)" >> "$GITHUB_OUTPUT"
build-plugin:
name: Build ESP from Spriggit files
needs: prepare
if: ${{ needs.prepare.outputs.should_run >= 1 || github.event_name == 'workflow_dispatch' && always() }}
permissions: write-all
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Create Pack Folder
run: mkdir -p $env:GITHUB_WORKSPACE\\to-pack
shell: pwsh
- name: Cache Spriggit
id: cache-spriggit
uses: actions/cache@v4
with:
path: .github/spriggit
key: ${{ runner.os }}-spriggit-${{ inputs.spriggit_tool_version }}
- name: Fetch Spriggit
if: steps.cache-spriggit.outputs.cache-hit != 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release download -R Mutagen-Modding/Spriggit --pattern "SpriggitCLI.zip" --dir .github
7z x .github/SpriggitCLI.zip -o".github/spriggit/"
if (Test-Path ".github/spriggit/Spriggit.CLI.exe") {
Write-Host "Spriggit.CLI.exe found and ready."
} else {
Write-Error "Spriggit.CLI.exe not found! Exiting."
exit 1
}
shell: pwsh
- name: Run Spriggit
run: .github\spriggit\Spriggit.CLI.exe deserialize --InputPath "res/esp" --OutputPath "res/esp/QuickLootIE.esp"
shell: cmd
- name: Upload Plugin Artifact
uses: actions/upload-artifact@v4
with:
name: plugin
path: res/esp/QuickLootIE.esp
compile-scripts:
name: Compile Papyrus scripts
needs: prepare
if: ${{ needs.prepare.outputs.should_run >= 1 || github.event_name == 'workflow_dispatch' && always() }}
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cache Script Sources
id: cache-ss
uses: actions/cache@v4
with:
path: |
.github/Papyrus/SRC
.github/Papyrus/SRC_SKYUI
.github/Papyrus/SRC_PAPUTIL
.github/Papyrus/SRC/TESV_Papyrus_Flags.flg
key: script-sources-clean
- name: Cache Compiler
id: cache-com
uses: actions/cache@v4
with:
path: .github/Caprica
key: ${{ runner.os }}-papyrus-compiler
- name: Fetch Caprica 0.3.0
if: steps.cache-com.outputs.cache-hit != 'true'
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
gh release download -O .github/Caprica.7z -p '*.7z' -R Orvid/Caprica v0.3.0
7z x .github/Caprica.7z "-o.github\Caprica"
- name: Checkout Papyrus Sources
if: steps.cache-ss.outputs.cache-hit != 'true'
run: |
mkdir .github/Papyrus
$repos = @("SRC", "SRC_SKYUI", "SRC_PAPUTIL")
Set-Location .github/Papyrus
foreach ($repo in $repos) {
New-Item -ItemType Directory -Name $repo
Set-Location $repo
git init
git remote add origin https://github.com/IHateMyKite/PAPYRUS.git
git sparse-checkout set --no-cone $repo
git fetch --depth=1 origin main
git checkout main
Remove-Item .git -Recurse -Force
Set-Location ..
}
- name: Checkout TESV Flags File
if: steps.cache-ss.outputs.cache-hit != 'true'
run: |
cd .github/Papyrus/SRC
mkdir temp
cd temp
git init
git remote add origin https://github.com/Rukan/Grimy-Skyrim-Papyrus-Source.git
git sparse-checkout set --no-cone 'TESV_Papyrus_Flags.flg'
git fetch --depth=1 origin master
git checkout master
Remove-Item .git -Recurse -Force
mv TESV_Papyrus_Flags.flg ../TESV_Papyrus_Flags.flg
Set-Location ..
Remove-Item temp -Recurse -Force
- name: Run Caprica
run: .github/Caprica/Caprica.exe --game skyrim --import ".github/Papyrus/SRC;.github/Papyrus/SRC_SKYUI;.github/Papyrus/SRC_PAPUTIL;" --output "res/pex/Scripts" --flags=".github/Papyrus/SRC/TESV_Papyrus_Flags.flg" "${{ github.workspace }}/res/pex/Source/Scripts" -R -q
- name: Upload Compiled Scripts Artifact
uses: actions/upload-artifact@v4
with:
name: compiled-scripts
path: res/pex/Scripts
compile-skse:
needs: prepare
if: ${{ needs.prepare.outputs.should_run >= 1 || github.event_name == 'workflow_dispatch' && always() }}
runs-on: windows-latest
steps:
- name: Recursive Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Set xmake env
run: echo "XMAKE_GLOBALDIR=${{ runner.workspace }}/xmake-global" >> $GITHUB_ENV
- name: Create xmake cache directories
run: |
mkdir -p ${{ env.XMAKE_GLOBALDIR }}/xmake-cache
mkdir -p ${{ env.XMAKE_GLOBALDIR }}/build-cache
- name: Cache xmake dependencies
uses: actions/cache@v4
with:
path: |
~/.xmake/packages
${{ env.XMAKE_GLOBALDIR }}/xmake-cache
key: xmake-deps-${{ runner.os }}-${{ hashFiles('xmake-require.lock') }}
restore-keys: |
xmake-deps-${{ runner.os }}-
- name: Cache xmake build cache
uses: actions/cache@v4
with:
path: ${{ env.XMAKE_GLOBALDIR }}/build-cache
key: xmake-build-${{ runner.os }}-${{ github.sha }}
restore-keys: |
xmake-build-${{ runner.os }}-
- name: Setup xmake
uses: xmake-io/github-action-setup-xmake@v1
with:
xmake-version: 'latest'
actions-cache-folder: ${{ env.XMAKE_GLOBALDIR }}/xmake-cache
actions-cache-key: '.xmake-actions-cache'
build-cache: true
build-cache-path: ${{ env.XMAKE_GLOBALDIR }}/build-cache
build-cache-key: xmake-build-${{ runner.os }}-${{ github.run_id }}
- name: Install dependencies
run: |
xmake repo --update
xmake require -y
- name: Compile SKSE plugin
run: xmake
- name: Verify output files
run: dir "${{ github.workspace }}/build/windows/x64/release"
- name: Upload SKSE Plugin Artifact
uses: actions/upload-artifact@v4
with:
name: skse-plugin
path: |
${{ github.workspace }}/build/windows/x64/release/QuickLootIE.dll
${{ github.workspace }}/build/windows/x64/release/QuickLootIE.pdb
package-mod:
name: Package all necessary files
runs-on: ubuntu-latest
needs: [build-plugin, compile-scripts, compile-skse, prepare]
if: ${{ needs.prepare.outputs.should_run >= 1 || github.event_name == 'workflow_dispatch' && always() }}
steps:
- name: Recursive Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
name: plugin
path: res/esp
- name: Download Compiled Scripts Artifact
uses: actions/download-artifact@v4
with:
name: compiled-scripts
path: res/pex/Scripts
- name: Download SKSE Plugin Artifact
uses: actions/download-artifact@v4
with:
name: skse-plugin
path: res/dll/SKSE/Plugins
- name: Create Release and Dev SDK Folders
run: |
mkdir -p "${{ github.workspace }}/to-pack/Source/Scripts"
mkdir -p "${{ github.workspace }}/to-pack/SKSE/Plugins"
mkdir -p "${{ github.workspace }}/to-pack/Interface"
mkdir -p "${{ github.workspace }}/to-pack/Scripts"
mkdir -p "${{ github.workspace }}/pack-dev/Interface"
mkdir -p "${{ github.workspace }}/pack-dev/LootMenuIE"
mkdir -p "${{ github.workspace }}/pack-dev/external"
mkdir -p "${{ github.workspace }}/pack-dev/include"
cp -a "LICENSE" "${{ github.workspace }}/to-pack/QLIE-LICENSE.md"
cp -a "res/dll/SKSE/Plugins/." "${{ github.workspace }}/to-pack/SKSE/Plugins"
cp -a "res/esp/QuickLootIE.esp" "${{ github.workspace }}/to-pack/QuickLootIE.esp"
cp -a "res/pex/Scripts/." "${{ github.workspace }}/to-pack/Scripts"
cp -a "res/pex/Source/Scripts/." "${{ github.workspace }}/to-pack/Source/Scripts"
cp -a "res/txt/Interface/." "${{ github.workspace }}/to-pack/Interface"
cp -a "res/swf/Interface/." "${{ github.workspace }}/to-pack/Interface"
cp -a "res/QuickLootIE.json" "${{ github.workspace }}/to-pack/SKSE/Plugins/QuickLootIE.json"
cp -a "LICENSE" "${{ github.workspace }}/pack-dev/QLIE-LICENSE.md"
cp -a "res/swf/Interface/LootMenuIE.swf" "${{ github.workspace }}/pack-dev/Interface"
cp -a "res/swf/Source/." "${{ github.workspace }}/pack-dev/LootMenuIE"
cp -a "include/." "${{ github.workspace }}/pack-dev/include"
cp -a "extern/CommonLibSSE-NG/Flash/." "${{ github.workspace }}/pack-dev/external"
- name: Zip Release Files
uses: vimtor/[email protected]
with:
files: to-pack/.
dest: QuickLootIE-${{ needs.prepare.outputs.version }}.zip
- name: Zip Dev SDK Files
uses: vimtor/[email protected]
with:
files: pack-dev/.
dest: QuickLootIE-DevSDK-${{ needs.prepare.outputs.version }}.zip
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: QuickLootIE-${{ needs.prepare.outputs.version }}
path: QuickLootIE-${{ needs.prepare.outputs.version }}.zip
- name: Upload Dev SDK Artifact
uses: actions/upload-artifact@v4
with:
name: QuickLootIE-DevSDK-${{ needs.prepare.outputs.version }}
path: QuickLootIE-DevSDK-${{ needs.prepare.outputs.version }}.zip
- name: Remove Temporary Artifacts
uses: geekyeggo/delete-artifact@v4
with:
name: |
plugin
skse-plugin
compiled-scripts
share-release:
name: Share release
needs: [package-mod, prepare]
if: ${{ inputs.publish-release == true && (needs.prepare.outputs.should_run >= 1 || github.event_name == 'workflow_dispatch' && always()) }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download Release Artifact
uses: actions/download-artifact@v4
with:
name: QuickLootIE-${{ needs.prepare.outputs.version }}
- name: Download Dev SDK Artifact
uses: actions/download-artifact@v4
with:
name: QuickLootIE-DevSDK-${{ needs.prepare.outputs.version }}
- name: Delete Existing Release
uses: dev-drprasad/[email protected]
with:
tag_name: ${{ needs.prepare.outputs.version }}
github_token: ${{ github.token }}
delete_release: true
- name: Create Release
id: create_release
uses: ncipollo/[email protected]
env:
GITHUB_TOKEN: ${{ github.token }}
with:
allowUpdates: true
name: QuickLootIE-${{ needs.prepare.outputs.version }} @ ${{ needs.prepare.outputs.date }}
draft: false
body: ${{ inputs.release-body }}
tag: ${{ needs.prepare.outputs.version }}
prerelease: true
makeLatest: false
removeArtifacts: true
replacesArtifacts: true
artifactErrorsFailBuild: true
artifacts: |
QuickLootIE-${{ needs.prepare.outputs.version }}.zip
QuickLootIE-DevSDK-${{ needs.prepare.outputs.version }}.zip
- name: Remove Temporary Artifacts
uses: geekyeggo/delete-artifact@v2
with:
name: |
QuickLootIE-${{ needs.prepare.outputs.version }}.zip
QuickLootIE-DevSDK-${{ needs.prepare.outputs.version }}.zip
failOnError: false