Watch DF Steam Releases #19323
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Watch DF Steam Releases | |
on: | |
schedule: | |
- cron: '8/10 * * * *' | |
workflow_dispatch: | |
jobs: | |
check-steam: | |
if: github.repository == 'DFHack/dfhack' | |
name: Check DF ${{ matrix.df_steam_branch }} branch | |
runs-on: ubuntu-latest | |
concurrency: steampoll-${{ matrix.df_steam_branch }} | |
strategy: | |
fail-fast: false | |
matrix: | |
# df_steam_branch: which DF Steam branch to watch | |
# platform: leave blank to default to all | |
# structures_ref: leave blank to default to master | |
# dfhack_ref: leave blank if no structures update is desired | |
# steam_branch: leave blank if no DFHack steam push is desired | |
include: | |
- df_steam_branch: public | |
- df_steam_branch: beta | |
structures_ref: adv-beta | |
dfhack_ref: adv-beta | |
steam_branch: adventure-beta | |
- df_steam_branch: testing | |
structures_ref: testing | |
dfhack_ref: testing | |
steps: | |
- name: Fetch state | |
uses: actions/cache/restore@v4 | |
with: | |
path: state | |
key: watchstate-${{ matrix.df_steam_branch }} | |
restore-keys: watchstate-${{ matrix.df_steam_branch }} | |
- name: Compare branch metadata | |
uses: nick-fields/retry@v3 | |
with: | |
timeout_minutes: 2 | |
command: | | |
timestamp=$(curl -X GET 'https://api.steamcmd.net/v1/info/975370?pretty=1' | \ | |
awk '/^ *"branches"/,0' | \ | |
awk '/^ *"${{ matrix.df_steam_branch }}"/,0' | \ | |
fgrep timeupdated | \ | |
head -n1 | \ | |
cut -d'"' -f4) | |
test -z "$timestamp" && echo "no timestamp result" && exit 1 | |
test "$timestamp" -gt 0 || exit 1 | |
echo "timestamp of last branch update: $timestamp" | |
mkdir -p state | |
touch state/timestamp | |
last_timestamp=$(cat state/timestamp) | |
echo "stored timestamp of last branch update: $last_timestamp" | |
if [ "$timestamp" != "$last_timestamp" ]; then | |
echo "$timestamp" >state/timestamp | |
echo TIMESTAMP=$timestamp >> $GITHUB_ENV | |
fi | |
- name: Discord Webhook Action | |
uses: tsickert/[email protected] | |
if: env.TIMESTAMP | |
with: | |
webhook-url: ${{ secrets.DISCORD_TEAM_PRIVATE_WEBHOOK_URL }} | |
content: "<@&${{ secrets.DISCORD_TEAM_ROLE_ID }}> DF Steam branch updated: ${{ matrix.df_steam_branch }}" | |
- name: Launch symbol generation workflow | |
if: env.TIMESTAMP && matrix.dfhack_ref | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
gh workflow run generate-symbols.yml \ | |
-R DFHack/dfhack \ | |
-r ${{ matrix.dfhack_ref }} \ | |
-f structures_ref=${{ matrix.structures_ref }} \ | |
-f version=auto \ | |
-f platform=${{ matrix.platform }} \ | |
-f channel=steam \ | |
-f df_steam_branch=${{ matrix.df_steam_branch }} \ | |
-f steam_branch=${{ matrix.steam_branch }} | |
- name: Save state | |
uses: actions/cache/save@v4 | |
if: env.TIMESTAMP | |
with: | |
path: state | |
key: watchstate-${{ matrix.df_steam_branch }}-${{ env.TIMESTAMP }} |