88 required : true
99 default : master
1010 version :
11- description : DF version
11+ description : DF version (can be "auto" if channel is steam)
1212 required : true
1313 platform :
1414 description : Target OS platform
4444 type : string
4545
4646jobs :
47- package :
47+ package-linux :
4848 uses : ./.github/workflows/build-linux.yml
4949 if : inputs.platform == 'all' || inputs.platform == 'linux'
5050 with :
@@ -57,12 +57,25 @@ jobs:
5757 plugins : false
5858 secrets : inherit
5959
60+ package-win64 :
61+ uses : ./.github/workflows/build-windows.yml
62+ if : (inputs.platform == 'all' || inputs.platform == 'windows') && inputs.version == 'auto'
63+ with :
64+ dfhack_ref : ${{ github.ref }}
65+ structures_ref : ${{ inputs.structures_ref }}
66+ artifact-name : dfhack-symbols-windows64-build
67+ append-date-and-hash : false
68+ cache-id : release
69+ cache-readonly : true
70+ plugins : false
71+ secrets : inherit
72+
6073 generate-linux :
6174 name : Generate linux64 symbols
6275 runs-on : ubuntu-latest
6376 if : inputs.platform == 'all' || inputs.platform == 'linux'
6477 needs :
65- - package
78+ - package-linux
6679 steps :
6780 - name : Install dependencies
6881 run : |
@@ -119,11 +132,29 @@ jobs:
119132 "+app_update 975370 $BETA_PARAMS validate" \
120133 +quit
121134 tar xjf dfhack-symbols-linux64-build.tar.bz2 -C DF_steam
122- xml/symbols_gen_linux.sh ${{ inputs.version }} STEAM DF_steam
135+ xml/symbols_gen_linux.sh ${{ inputs.version == 'auto' && '50.0' || inputs.version }} STEAM DF_steam
136+ if [ "${{ inputs.version }}" = "auto" ]; then
137+ while pgrep dwarfort; do
138+ echo "waiting for DF to exit"
139+ sleep 0.5
140+ done
141+ cp xml/symbols.xml DF_steam/hack
142+ cd DF_steam
143+ DFHACK_DISABLE_CONSOLE=1 ./dfhack &
144+ while ! ./dfhack-run lua 'print(scr)' | fgrep 'viewscreen_titlest' 2>/dev/null; do
145+ echo "waiting for DF to start"
146+ sleep 0.5
147+ done
148+ df_ver=`./dfhack-run lua 'print(dfhack.gui.getDFViewscreen(true).str_version)' | ansifilter`
149+ echo "Found version string: '$df_ver'"
150+ echo "DETECTED_DF_VER=$df_ver" >>$GITHUB_ENV
151+ sed -i "s/v0.50.0 linux64 STEAM/v0.$df_ver linux64 STEAM/" ../xml/symbols.xml
152+ ./dfhack-run die || true
153+ fi
123154
124155 # Itch
125156 - name : Generate Itch symbols
126- if : inputs.channel == 'all' || inputs.channel == 'itch'
157+ if : ( inputs.channel == 'all' || inputs.channel == 'itch') && inputs.version != 'auto '
127158 env :
128159 DISPLAY : :0
129160 ITCH_API_KEY : ${{ secrets.ITCH_API_KEY }}
@@ -139,7 +170,7 @@ jobs:
139170
140171 # Classic
141172 - name : Generate Classic symbols
142- if : inputs.channel == 'all' || inputs.channel == 'classic'
173+ if : ( inputs.channel == 'all' || inputs.channel == 'classic') && inputs.version != 'auto '
143174 env :
144175 DISPLAY : :0
145176 run : |
@@ -164,7 +195,7 @@ jobs:
164195 - name : Commit symbol updates
165196 uses : stefanzweifel/git-auto-commit-action@v5
166197 with :
167- commit_message : Auto-update symbols
198+ commit_message : Auto-update symbols for Linux DF version ${{ env.DETECTED_DF_VER || inputs.version }}
168199 repository : xml
169200 commit_user_name : DFHack-Urist via GitHub Actions
170201 commit_user_email :
[email protected] @@ -227,11 +258,11 @@ jobs:
227258 +login $STEAM_USERNAME \
228259 "+app_update 975370 $BETA_PARAMS validate" \
229260 +quit
230- xml/symbols_gen_windows.sh ${{ inputs.version }} STEAM DF_steam
261+ xml/symbols_gen_windows.sh ${{ inputs.version == 'auto' && '50.0' || inputs.version }} STEAM DF_steam
231262
232263 # Itch
233264 - name : Generate Itch symbols
234- if : inputs.channel == 'all' || inputs.channel == 'itch'
265+ if : ( inputs.channel == 'all' || inputs.channel == 'itch') && inputs.version != 'auto '
235266 env :
236267 ITCH_API_KEY : ${{ secrets.ITCH_API_KEY }}
237268 run : |
@@ -245,7 +276,7 @@ jobs:
245276
246277 # Classic
247278 - name : Generate Classic symbols
248- if : inputs.channel == 'all' || inputs.channel == 'classic'
279+ if : ( inputs.channel == 'all' || inputs.channel == 'classic') && inputs.version != 'auto '
249280 run : |
250281 mkdir DF_classic
251282 minor=$(echo "${{ inputs.version }}" | cut -d. -f1)
@@ -267,7 +298,86 @@ jobs:
267298 - name : Commit symbol updates
268299 uses : stefanzweifel/git-auto-commit-action@v5
269300 with :
270- commit_message : Auto-update symbols
301+ commit_message : Auto-update symbols for Windows DF version ${{ inputs.version }}
302+ repository : xml
303+ commit_user_name : DFHack-Urist via GitHub Actions
304+ commit_user_email :
[email protected] 305+
306+ auto-ver-windows :
307+ name : Autodetect DF version string (Windows)
308+ if : (inputs.platform == 'all' || inputs.platform == 'windows') && (inputs.channel == 'all' || inputs.channel == 'steam') && inputs.version == 'auto'
309+ needs :
310+ - package-win64
311+ - generate-windows
312+ runs-on : windows-latest
313+ steps :
314+ - name : Clone structures
315+ uses : actions/checkout@v4
316+ with :
317+ repository : DFHack/df-structures
318+ ref : ${{ inputs.structures_ref }}
319+ token : ${{ secrets.DFHACK_GITHUB_TOKEN }}
320+ path : xml
321+ - name : Download DFHack
322+ uses : actions/download-artifact@v4
323+ with :
324+ name : dfhack-symbols-windows64-build
325+ - name : Setup steamcmd
326+ id : steamcmd
327+ uses : CyberAndrii/setup-steamcmd@v1
328+ - name : Update DF version string
329+ env :
330+ STEAM_USERNAME : ${{ secrets.STEAM_USERNAME }}
331+ STEAM_CONFIG_VDF : ${{ secrets.STEAM_CONFIG_VDF }}
332+ STEAM_DF_TESTING : ${{ secrets.STEAM_DF_TESTING }}
333+ STEAM_DF_ADVENTURE_TEST : ${{ secrets.STEAM_DF_ADVENTURE_TEST }}
334+ shell : bash
335+ run : |
336+ mkdir DF_steam
337+ echo "$STEAM_CONFIG_VDF" | base64 -d >${{ steps.steamcmd.outputs.directory }}/config/config.vdf
338+ echo "DF steam branch: ${{ inputs.df_steam_branch }}"
339+ if [ "${{ inputs.df_steam_branch }}" = "default" ]; then
340+ BETA_PARAMS=""
341+ elif [ "${{ inputs.df_steam_branch }}" = "testing" ]; then
342+ BETA_PARAMS="-beta testing -betapassword $STEAM_DF_TESTING"
343+ elif [ "${{ inputs.df_steam_branch }}" = "adventure_test" ]; then
344+ BETA_PARAMS="-beta adventure_test -betapassword $STEAM_DF_ADVENTURE_TEST"
345+ else
346+ BETA_PARAMS="-beta ${{ inputs.df_steam_branch }}"
347+ fi
348+ ${{ steps.steamcmd.outputs.executable }} \
349+ +@ShutdownOnFailedCommand 1 \
350+ +@sSteamCmdForcePlatformType windows \
351+ +force_install_dir $PWD/DF_steam \
352+ +login $STEAM_USERNAME \
353+ "+app_update 975370 $BETA_PARAMS validate" \
354+ +quit
355+ tar xjf dfhack-symbols-windows64-build.tar.bz2 -C DF_steam
356+ cp xml/symbols.xml DF_steam/hack
357+ cd DF_steam
358+ "./Dwarf Fortress.exe" &
359+ while ! ./dfhack-run.exe lua 'print(scr)' | fgrep 'viewscreen_titlest' 2>/dev/null; do
360+ echo "waiting for DF to start"
361+ sleep 0.5
362+ done
363+ df_ver=`./dfhack-run.exe lua 'print(dfhack.gui.getDFViewscreen(true).str_version)'`
364+ echo "Found version string: '$df_ver'"
365+ echo "DETECTED_DF_VER=$df_ver" >>$GITHUB_ENV
366+ sed -i "s/v0.50.0 win64 STEAM/v0.$df_ver win64 STEAM/" ../xml/symbols.xml
367+ ./dfhack-run.exe die || true
368+ - name : Merge updates
369+ shell : bash
370+ run : |
371+ cd xml
372+ if ! git diff --exit-code; then
373+ git stash
374+ git pull
375+ git stash pop
376+ fi
377+ - name : Commit symbol updates
378+ uses : stefanzweifel/git-auto-commit-action@v5
379+ with :
380+ commit_message : Auto-update Windows DF version to ${{ env.DETECTED_DF_VER }} in symbols
271381 repository : xml
272382 commit_user_name : DFHack-Urist via GitHub Actions
273383 commit_user_email :
[email protected] @@ -277,28 +387,32 @@ jobs:
277387 runs-on : ubuntu-latest
278388 needs :
279389 - generate-linux
280- - generate -windows
390+ - auto-ver -windows
281391 if : ${{ ! failure() }}
282392 steps :
283393 - name : Clone DFHack
284394 uses : actions/checkout@v4
285395 with :
286396 token : ${{ secrets.DFHACK_GITHUB_TOKEN }}
287397 - name : Update ref
398+ shell : bash
288399 run : |
289400 git submodule update --init --no-single-branch library/xml
290401 cd library/xml
291402 git checkout ${{ inputs.structures_ref }}
292403 git pull
404+ df_ver=`grep -E 'symbol-table.*STEAM' symbols.xml | head -n1 | sed -r "s/.*name='v0.([^ ]+) .*/\1/"`
405+ echo "using DF version: $df_ver"
406+ echo "DETECTED_DF_VER=$df_ver" >>$GITHUB_ENV
293407 - name : Commit ref update
294408 uses : stefanzweifel/git-auto-commit-action@v5
295409 with :
296- commit_message : Auto-update structures ref
410+ commit_message : Auto-update structures ref for ${{ env.DETECTED_DF_VER }}
297411 commit_user_name : DFHack-Urist via GitHub Actions
298412 commit_user_email :
[email protected] 299413 - name : Launch steam-deploy
300414 if : inputs.steam_branch
301415 shell : bash
302416 env :
303417 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
304- run : gh workflow run steam-deploy.yml -R DFHack/dfhack -r ${{ github.ref }} -f version=${{ inputs.version }} -f steam_branch=${{ inputs.steam_branch }}
418+ run : gh workflow run steam-deploy.yml -R DFHack/dfhack -r ${{ github.ref }} -f version=${{ env.DETECTED_DF_VER }} -f steam_branch=${{ inputs.steam_branch }}
0 commit comments