-
Notifications
You must be signed in to change notification settings - Fork 0
237 lines (209 loc) · 8.7 KB
/
build-release.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
name: Build Release
on:
schedule:
- cron: '0 9 * * *'
workflow_dispatch:
inputs:
papyrus-version:
description: 'Papyrus scripts version? (e.g. 1.10.30.0, Defaults to latest)'
required: false
default: '1.10.30.0'
version:
description: 'Release version (defaults to "Nightly")'
required: false
publish-release:
description: Publish Release?
type: boolean
default: true
spriggit_tool_version:
description: Spriggit version (optional)
required: false
jobs:
check-changes:
name: Check for recent changes
if: ${{github.event_name != 'workflow_dispatch'}}
runs-on: ubuntu-latest
outputs:
should_run: ${{ steps.should_run.outputs.should_run }}
steps:
- uses: actions/checkout@v4
- 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 ESM from Spriggit files
needs: check-changes
if: ${{ needs.check-changes.outputs.should_run >= 1 || (github.event_name == 'workflow_dispatch' && always()) }}
permissions: write-all
runs-on: ubuntu-latest
steps:
- name: Output Inputs
run: |
echo "GitHub Event Inputs: ${{ toJSON(github.event.inputs) }}"
echo "Inputs: ${{ toJSON(inputs) }}"
- name: Checkout
uses: actions/checkout@v4
- name: Copy to Pack Folder
shell: bash
run: |
mkdir ${{ github.workspace }}/to-pack
cp -r Docs/ ${{ github.workspace }}/to-pack/Docs/
- name: Fetch spriggit
shell: bash
run: gh release download -O .github/spriggit.zip -p 'SpriggitLinuxCLI.zip' -R Mutagen-Modding/Spriggit ${{ inputs.spriggit_tool_version }}
env:
GH_TOKEN: ${{ github.token }}
- name: Extract Spriggit Zip
shell: bash
run: 7z x .github/spriggit.zip -o.github/spriggit
- name: fix spriggit permission
shell: bash
run: chmod +x .github/spriggit/Spriggit.CLI
- name: run spriggit
shell: bash
run: .github/spriggit/Spriggit.CLI deserialize --InputPath "spriggit" --OutputPath "${{ github.workspace }}/to-pack/StarfieldCommunityPatch.esm"
- name: Upload plugin and strings
uses: actions/upload-artifact@v4
with:
name: plugin-and-strings
path: |
${{ github.workspace }}/to-pack/StarfieldCommunityPatch.esm
${{ github.workspace }}/to-pack/Strings/
compile-scripts:
name: Compile Papyrus scripts
needs: check-changes
if: ${{ needs.check-changes.outputs.should_run >= 1 || (github.event_name == 'workflow_dispatch' && always()) }}
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
sparse-checkout: Scripts
# Fetch and extract the tools we need
- name: Fetch Caprica 0.3.0
shell: bash
run: gh release download -O .github/Caprica.7z -p '*.7z' -R Orvid/Caprica v0.3.0
env:
GH_TOKEN: ${{ github.token }}
- name: Extract Caprica EXE file
shell: bash
run: 7z x .github/Caprica.7z -o.github/Caprica
- name: Fetch vanilla scripts
shell: bash
run: |
curl -L -o .github/Scripts.7z -H "key: ${{ secrets.PAPYRUS_KEY }}" "https://starfieldpatch.dev/api/papyrus/get?version=${{inputs.papyrus-version}}"
- name: Extract vanilla scripts
shell: bash
run: 7z x .github/Scripts.7z -o.github/Scripts
# Perform the actions to build a release.
- name: Run Caprica
shell: bash
run: .github/Caprica/Caprica.exe --game starfield --import ".github/Scripts" --output "Scripts" "Scripts/source" -R -q
- name: Upload Output
uses: actions/upload-artifact@v4
with:
name: compiled-scripts
path: |
Scripts/
package-mod:
name: Package with BA2
runs-on: windows-latest
if: ${{ needs.check-changes.outputs.should_run >= 1 || (github.event_name == 'workflow_dispatch' && always()) }}
needs: [build-plugin, compile-scripts]
permissions: write-all
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download Compiled Scripts
uses: actions/download-artifact@v4
with:
name: compiled-scripts
path: Scripts
- name: Download Compiled Plugin
uses: actions/download-artifact@v4
with:
name: plugin-and-strings
- name: Fetch xEdit (to get BSArchPro)
shell: bash
run: gh release download -O .github/xEdit.7z -p '*.7z' -R TES5Edit/TES5Edit xedit-4.1.5
env:
GH_TOKEN: ${{ github.token }}
- name: Extract xEdit files
shell: bash
run: 7z x .github/xEdit.7z -o.github/xEdit
- name: Create SFCP.bsarch (Assets.json) for BSArchPro
uses: actions/github-script@v7
with:
script: |
const generateAssets = require('./.github/workflows/generateAssets.js')
await generateAssets({ github, context })
- name: Run BSArchPro to create the archive(s)
shell: bash
run: .github/xEdit/BSArchPro64.exe "${{ github.workspace }}/.github/SFCP.bsarch"
- name: Create packing structure
shell: bash
run: |
mkdir "${{ github.workspace }}\to-pack"
mkdir "${{ github.workspace }}\to-pack\Data"
cp "StarfieldCommunityPatch - Main.ba2" "${{ github.workspace }}\to-pack\Data\StarfieldCommunityPatch - Main.ba2"
cp "StarfieldCommunityPatch.esm" "${{ github.workspace }}\to-pack\Data\StarfieldCommunityPatch.esm"
cp "StarfieldCommunityPatch.ini" "${{ github.workspace }}\to-pack\Data\StarfieldCommunityPatch.ini"
ls -R "${{ github.workspace }}\to-pack"
- name: Zip up release files
uses: vimtor/action-zip@v1.2
with:
files: to-pack/
dest: StarfieldCommunityPatch-${{inputs.version || 'nightly'}}.zip
- name: Upload Output
uses: actions/upload-artifact@v4
with:
name: StarfieldCommunityPatch-${{inputs.version || 'nightly'}}
path: StarfieldCommunityPatch-${{inputs.version || 'nightly'}}.zip
- name: Remove temporary artifacts
uses: geekyeggo/delete-artifact@v4
with:
name: |
plugin-and-strings
compiled-scripts
share-release:
name: Share release
needs: [package-mod]
if: ${{ inputs.publish-release == true && (needs.check-changes.outputs.should_run >= 1 || (github.event_name == 'workflow_dispatch' && always())) }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download the release artifact
uses: actions/download-artifact@v4
with:
name: StarfieldCommunityPatch-${{inputs.version || 'nightly'}}
- name: Delete Existing Release
uses: dev-drprasad/delete-tag-and-release@v1.0
with:
tag_name: ${{inputs.version || 'nightly'}}
github_token: ${{ secrets.GITHUB_TOKEN }}
delete_release: true
- name: Create Release
id: create_release
uses: ncipollo/release-action@v1.13.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
allowUpdates: true
name: ${{inputs.version || 'Nightly'}}
draft: false
body: 'Latest release of the patch. Changelog at https://www.starfieldpatch.dev/changelog'
tag: ${{inputs.version || 'nightly'}}
prerelease: true
makeLatest: false
removeArtifacts: true
replacesArtifacts: true
artifactErrorsFailBuild: true
artifacts: StarfieldCommunityPatch-${{inputs.version || 'nightly'}}.zip
- name: Remove temporary artifacts
uses: geekyeggo/delete-artifact@v2
with:
name: |
StarfieldCommunityPatch-${{inputs.version || 'nightly'}}