Skip to content

Commit

Permalink
move workflow back to dfhack so it can call other workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
myk002 committed Apr 18, 2024
1 parent 88a598a commit 88fad95
Showing 1 changed file with 64 additions and 0 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/watch-df-steam.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Watch DF Steam Releases

on:
schedule:
- cron: '8/10 * * * *'

jobs:
check-steam:
name: Check DF ${{ matrix.df_steam_branch }} branch
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- dfhack_ref: adv-beta
structures_ref: adv-beta
version: 51.01-beta
df_steam_branch: beta
steam_branch: adventure-beta
steps:
- name: Setup steamcmd
id: steamcmd
uses: CyberAndrii/setup-steamcmd@v1
- name: Get current time
shell: bash
run: echo TIMESTAMP_SECONDS="$(date +'%s')" >> $GITHUB_ENV
- name: Fetch state
uses: actions/cache/restore@v4
with:
path: state
key: watchstate-${{ matrix.version }}-${{ env.TIMESTAMP_SECONDS }}
restore-keys: watchstate-${{ matrix.version }}
- name: Detect changes on branch
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
STEAM_USERNAME: ${{ secrets.STEAM_USERNAME }}
STEAM_CONFIG_VDF: ${{ secrets.STEAM_CONFIG_VDF }}
run: |
mkdir -p $HOME/Steam/config
echo "$STEAM_CONFIG_VDF" | base64 -d >$HOME/Steam/config/config.vdf
timestamp=$(${{ steps.steamcmd.outputs.executable }} \
+@ShutdownOnFailedCommand 1 \
+login $STEAM_USERNAME \
+app_info_request 975370 \
+app_info_print 975370 \
+quit | awk '/^{/,0' | awk '/^\t\t"branches"/,0' | awk '/^\t\t\t"beta"/,0' | fgrep timeupdated | head -n1 | cut -d'"' -f4)
echo "timestamp: $timestamp"
mkdir -p state
touch state/timestamp
last_timestamp=$(cat state/timestamp)
echo "last_timestamp: $last_timestamp"
if [ "$timestamp" != "$last_timestamp" ]; then
echo "launching generate-symbols"
echo "$timestamp" >state/timestamp
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=all -f channel=steam -f df_steam_branch=${{ matrix.df_steam_branch }} -f steam_branch=${{ matrix.steam_branch }}
echo TIMESTAMP_UPDATED=1 >> $GITHUB_ENV
fi
- name: Save state
uses: actions/cache/save@v4
if: env.TIMESTAMP_UPDATED
with:
path: state
key: watchstate-${{ matrix.version }}-${{ env.TIMESTAMP_SECONDS }}

0 comments on commit 88fad95

Please sign in to comment.