-
Notifications
You must be signed in to change notification settings - Fork 475
304 lines (291 loc) · 10.3 KB
/
generate-symbols.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
303
304
name: Generate symbols
on:
workflow_dispatch:
inputs:
structures_ref:
description: Structures branch to build from and update
required: true
default: master
version:
description: DF version
required: true
platform:
description: Target OS platform
type: choice
required: true
default: all
options:
- all
- windows
- linux
channel:
description: DF distribution channel
type: choice
required: true
default: all
options:
- all
- steam
- itch
- classic
df_steam_branch:
description: DF Steam branch to read from (if processing Steam distribution channel)
required: true
type: choice
default: default
options:
- default
- testing
- adventure_test
- beta
steam_branch:
description: DFHack Steam branch to deploy to (leave blank to skip deploy)
type: string
jobs:
package:
uses: ./.github/workflows/build-linux.yml
if: inputs.platform == 'all' || inputs.platform == 'linux'
with:
dfhack_ref: ${{ github.ref }}
structures_ref: ${{ inputs.structures_ref }}
artifact-name: dfhack-symbols-linux64-build
append-date-and-hash: false
cache-id: release
cache-readonly: true
plugins: false
secrets: inherit
generate-linux:
name: Generate linux64 symbols
runs-on: ubuntu-latest
if: inputs.platform == 'all' || inputs.platform == 'linux'
needs:
- package
steps:
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install \
ansifilter \
libsdl2-2.0-0 \
libsdl2-image-2.0-0
- name: Clone structures
uses: actions/checkout@v4
with:
repository: DFHack/df-structures
ref: ${{ inputs.structures_ref }}
token: ${{ secrets.DFHACK_GITHUB_TOKEN }}
path: xml
- name: Download DFHack
uses: actions/download-artifact@v4
with:
name: dfhack-symbols-linux64-build
- name: Start X server
run: Xvfb :0 -screen 0 1600x1200x24 &
# Steam
- name: Setup steamcmd
if: inputs.channel == 'all' || inputs.channel == 'steam'
id: steamcmd
uses: CyberAndrii/setup-steamcmd@v1
- name: Generate Steam symbols
if: inputs.channel == 'all' || inputs.channel == 'steam'
env:
DISPLAY: :0
STEAM_USERNAME: ${{ secrets.STEAM_USERNAME }}
STEAM_CONFIG_VDF: ${{ secrets.STEAM_CONFIG_VDF }}
STEAM_DF_TESTING: ${{ secrets.STEAM_DF_TESTING }}
STEAM_DF_ADVENTURE_TEST: ${{ secrets.STEAM_DF_ADVENTURE_TEST }}
run: |
mkdir DF_steam
mkdir -p $HOME/Steam/config
echo "$STEAM_CONFIG_VDF" | base64 -d >$HOME/Steam/config/config.vdf
echo "DF steam branch: ${{ inputs.df_steam_branch }}"
if [ "${{ inputs.df_steam_branch }}" = "default" ]; then
BETA_PARAMS=""
elif [ "${{ inputs.df_steam_branch }}" = "testing" ]; then
BETA_PARAMS="-beta testing -betapassword $STEAM_DF_TESTING"
elif [ "${{ inputs.df_steam_branch }}" = "adventure_test" ]; then
BETA_PARAMS="-beta adventure_test -betapassword $STEAM_DF_ADVENTURE_TEST"
else
BETA_PARAMS="-beta ${{ inputs.df_steam_branch }}"
fi
${{ steps.steamcmd.outputs.executable }} \
+@ShutdownOnFailedCommand 1 \
+force_install_dir $PWD/DF_steam \
+login $STEAM_USERNAME \
"+app_update 975370 $BETA_PARAMS validate" \
+quit
tar xjf dfhack-symbols-linux64-build.tar.bz2 -C DF_steam
xml/symbols_gen_linux.sh ${{ inputs.version }} STEAM DF_steam
# Itch
- name: Generate Itch symbols
if: inputs.channel == 'all' || inputs.channel == 'itch'
env:
DISPLAY: :0
ITCH_API_KEY: ${{ secrets.ITCH_API_KEY }}
run: |
mkdir DF_itch
pip install itch-dl
minor=$(echo "${{ inputs.version }}" | cut -d. -f1)
patch=$(echo "${{ inputs.version }}" | cut -d. -f2)
itch-dl https://kitfoxgames.itch.io/dwarf-fortress --download-to . --api-key $ITCH_API_KEY
tar xjf "kitfoxgames/dwarf-fortress/files/dwarf_fortress_${minor}_${patch}_linux.tar.bz2" -C DF_itch
tar xjf dfhack-symbols-linux64-build.tar.bz2 -C DF_itch
xml/symbols_gen_linux.sh ${{ inputs.version }} ITCH DF_itch
# Classic
- name: Generate Classic symbols
if: inputs.channel == 'all' || inputs.channel == 'classic'
env:
DISPLAY: :0
run: |
mkdir DF_classic
minor=$(echo "${{ inputs.version }}" | cut -d. -f1)
patch=$(echo "${{ inputs.version }}" | cut -d. -f2)
fname="df_${minor}_${patch}_linux.tar.bz2"
wget "https://www.bay12games.com/dwarves/${fname}"
tar xjf "${fname}" -C DF_classic
tar xjf dfhack-symbols-linux64-build.tar.bz2 -C DF_classic
xml/symbols_gen_linux.sh ${{ inputs.version }} CLASSIC DF_classic
# Finalize
- name: Merge updates
run: |
cd xml
if ! git diff --exit-code; then
git stash
git pull
git stash pop
fi
- name: Commit symbol updates
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Auto-update symbols
repository: xml
commit_user_name: DFHack-Urist via GitHub Actions
commit_user_email: 63161697+DFHack-Urist@users.noreply.github.com
generate-windows:
name: Generate win64 symbols
runs-on: ubuntu-latest
if: inputs.platform == 'all' || inputs.platform == 'windows'
steps:
- name: Install dependencies
run: pip install pefile
- name: Clone structures
uses: actions/checkout@v4
with:
repository: DFHack/df-structures
ref: ${{ inputs.structures_ref }}
token: ${{ secrets.DFHACK_GITHUB_TOKEN }}
path: xml
- name: Clone df_misc
uses: actions/checkout@v4
with:
repository: DFHack/df_misc
path: df_misc
- name: Clone metasm
uses: actions/checkout@v4
with:
repository: jjyg/metasm
path: metasm
# Steam
- name: Setup steamcmd
if: inputs.channel == 'all' || inputs.channel == 'steam'
id: steamcmd
uses: CyberAndrii/setup-steamcmd@v1
- name: Generate Steam symbols
if: inputs.channel == 'all' || inputs.channel == 'steam'
env:
STEAM_USERNAME: ${{ secrets.STEAM_USERNAME }}
STEAM_CONFIG_VDF: ${{ secrets.STEAM_CONFIG_VDF }}
STEAM_DF_TESTING: ${{ secrets.STEAM_DF_TESTING }}
STEAM_DF_ADVENTURE_TEST: ${{ secrets.STEAM_DF_ADVENTURE_TEST }}
run: |
mkdir DF_steam
mkdir -p $HOME/Steam/config
echo "$STEAM_CONFIG_VDF" | base64 -d >$HOME/Steam/config/config.vdf
echo "DF steam branch: ${{ inputs.df_steam_branch }}"
if [ "${{ inputs.df_steam_branch }}" = "default" ]; then
BETA_PARAMS=""
elif [ "${{ inputs.df_steam_branch }}" = "testing" ]; then
BETA_PARAMS="-beta testing -betapassword $STEAM_DF_TESTING"
elif [ "${{ inputs.df_steam_branch }}" = "adventure_test" ]; then
BETA_PARAMS="-beta adventure_test -betapassword $STEAM_DF_ADVENTURE_TEST"
else
BETA_PARAMS="-beta ${{ inputs.df_steam_branch }}"
fi
${{ steps.steamcmd.outputs.executable }} \
+@ShutdownOnFailedCommand 1 \
+@sSteamCmdForcePlatformType windows \
+force_install_dir $PWD/DF_steam \
+login $STEAM_USERNAME \
"+app_update 975370 $BETA_PARAMS validate" \
+quit
xml/symbols_gen_windows.sh ${{ inputs.version }} STEAM DF_steam
# Itch
- name: Generate Itch symbols
if: inputs.channel == 'all' || inputs.channel == 'itch'
env:
ITCH_API_KEY: ${{ secrets.ITCH_API_KEY }}
run: |
mkdir DF_itch
pip install itch-dl
minor=$(echo "${{ inputs.version }}" | cut -d. -f1)
patch=$(echo "${{ inputs.version }}" | cut -d. -f2)
itch-dl https://kitfoxgames.itch.io/dwarf-fortress --download-to . --api-key $ITCH_API_KEY
unzip -d DF_itch "kitfoxgames/dwarf-fortress/files/dwarf_fortress_${minor}_${patch}_windows.zip"
xml/symbols_gen_windows.sh ${{ inputs.version }} ITCH DF_itch
# Classic
- name: Generate Classic symbols
if: inputs.channel == 'all' || inputs.channel == 'classic'
run: |
mkdir DF_classic
minor=$(echo "${{ inputs.version }}" | cut -d. -f1)
patch=$(echo "${{ inputs.version }}" | cut -d. -f2)
fname="df_${minor}_${patch}_win.zip"
wget "https://www.bay12games.com/dwarves/${fname}"
unzip -d DF_classic "${fname}"
xml/symbols_gen_windows.sh ${{ inputs.version }} CLASSIC DF_classic
# Finalize
- name: Merge updates
run: |
cd xml
if ! git diff --exit-code; then
git stash
git pull
git stash pop
fi
- name: Commit symbol updates
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Auto-update symbols
repository: xml
commit_user_name: DFHack-Urist via GitHub Actions
commit_user_email: 63161697+DFHack-Urist@users.noreply.github.com
update-ref:
name: Update structures ref
runs-on: ubuntu-latest
needs:
- generate-linux
- generate-windows
if: ${{ ! failure() }}
steps:
- name: Clone DFHack
uses: actions/checkout@v4
with:
token: ${{ secrets.DFHACK_GITHUB_TOKEN }}
- name: Update ref
run: |
git submodule update --init --no-single-branch library/xml
cd library/xml
git checkout ${{ inputs.structures_ref }}
git pull
- name: Commit ref update
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Auto-update structures ref
commit_user_name: DFHack-Urist via GitHub Actions
commit_user_email: 63161697+DFHack-Urist@users.noreply.github.com
- name: Launch steam-deploy
if: inputs.steam_branch
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh workflow run steam-deploy.yml -R DFHack/dfhack -r ${{ github.ref }} -f version=${{ inputs.version }} -f steam_branch=${{ inputs.steam_branch }}