Watch DF Steam Releases #23933
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: | |
# dfhack_ref: leave blank if no structures update is desired | |
# structures_ref: leave blank to default to master | |
# steam_branch: leave blank if no steam push is desired | |
# platform: leave blank to default to all | |
# channel: leave blank to default to all; should usually be steam | |
include: | |
- df_steam_branch: public | |
version: public | |
- df_steam_branch: beta | |
version: 51.01-beta | |
channel: steam | |
dfhack_ref: adv-beta | |
structures_ref: adv-beta | |
steam_branch: adventure-beta | |
- df_steam_branch: testing | |
version: testing | |
channel: steam | |
dfhack_ref: testing | |
structures_ref: testing | |
steps: | |
- name: Fetch state | |
uses: actions/cache/restore@v4 | |
with: | |
path: state | |
key: watchstate-${{ matrix.version }} | |
restore-keys: watchstate-${{ matrix.version }} | |
- 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/discord-webhook@v5.3.0 | |
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=${{ matrix.version }} \ | |
-f platform=${{ matrix.platform }} \ | |
-f channel=${{ matrix.channel }} \ | |
-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.version }}-${{ env.TIMESTAMP }} |