Workflow file for this run
This file contains hidden or 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: GameTracking | ||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| appid: | ||
| required: true | ||
| type: string | ||
| branch: | ||
| required: false | ||
| type: string | ||
| default: 'public' | ||
| run-on-windows: | ||
| required: false | ||
| type: boolean | ||
| default: false | ||
| save-manifest: | ||
| required: false | ||
| type: boolean | ||
| default: false | ||
| reset-gametracking: | ||
| required: false | ||
| type: boolean | ||
| default: false | ||
| dumpsource2-schema-json: | ||
| required: false | ||
| type: string | ||
| default: '' | ||
| secrets: | ||
| STEAM_USERNAME: | ||
| required: true | ||
| STEAM_PASSWORD: | ||
| required: true | ||
| jobs: | ||
| gametracking-setup: | ||
| runs-on: ${{ inputs.run-on-windows && 'windows-latest' || 'ubuntu-latest' }} | ||
| permissions: | ||
| contents: write | ||
| statuses: write | ||
| steps: | ||
| # Checkout and download tools | ||
| - name: Checkout shared GameTracking | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| fetch-depth: 1 | ||
| repository: 'SteamTracking/GameTracking' | ||
| - name: Download pre-built tools | ||
| shell: bash | ||
| run: | | ||
| if [[ "$(uname -s)" == MINGW* ]] || [[ "$(uname -s)" == MSYS* ]]; then | ||
| ARCHIVE="tools-win-x64.tar.gz" | ||
| else | ||
| ARCHIVE="tools-linux-x64.tar.gz" | ||
| fi | ||
| gh release download tools \ | ||
| --repo SteamTracking/GameTracking \ | ||
| --pattern "$ARCHIVE" \ | ||
| --dir . | ||
| tar xzf "$ARCHIVE" -C tools/ | ||
| rm "$ARCHIVE" | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| - name: Checkout game repository (${{ github.repository }}) | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| fetch-depth: 1 | ||
| path: tracked_game | ||
| # Optional Node.js setup | ||
| - name: Check for package-lock.json | ||
| id: package-lock-json-exists | ||
| shell: bash | ||
| run: echo "exists=$(test -f ${{ github.workspace }}/tracked_game/package-lock.json && echo true || echo false)" >> $GITHUB_OUTPUT | ||
| - name: Setup Node.js | ||
| if: steps.package-lock-json-exists.outputs.exists == 'true' | ||
| uses: actions/setup-node@v6 | ||
| with: | ||
| node-version: '22' | ||
| cache: 'npm' | ||
| cache-dependency-path: ${{ github.workspace }}/tracked_game/package-lock.json | ||
| - name: Install Node.js dependencies | ||
| if: steps.package-lock-json-exists.outputs.exists == 'true' | ||
| working-directory: ${{ github.workspace }}/tracked_game | ||
| run: npm ci | ||
| # Download and process | ||
| - name: Configure git user | ||
| run: | | ||
| git config --global user.name "github-actions[bot]" | ||
| git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | ||
| git config --global core.safecrlf false | ||
| - name: Get current commit SHA | ||
| id: before | ||
| working-directory: ${{ github.workspace }}/tracked_game | ||
| shell: bash | ||
| run: echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT | ||
| - name: Delete all folders for cleanup | ||
| if: ${{ inputs.reset-gametracking }} | ||
| working-directory: ${{ github.workspace }}/tracked_game | ||
| shell: bash | ||
| run: | | ||
| find . -mindepth 1 -maxdepth 1 -type d \ | ||
| ! -name 'node_modules' \ | ||
| ! -name '.git' \ | ||
| ! -name '.github' \ | ||
| -exec rm -rf {} \; | ||
| - name: Download app ${{ inputs.appid }} | ||
| working-directory: ${{ github.workspace }}/tracked_game | ||
| shell: bash | ||
| run: | | ||
| . ../common.sh | ||
| $STEAM_FILE_DOWNLOADER_PATH --username "${{ secrets.STEAM_USERNAME }}" --password "${{ secrets.STEAM_PASSWORD }}" --appid "${{ inputs.appid }}" --output . --branch "${{ inputs.branch }}" ${{ inputs.save-manifest && '--save-manifest' || '' }} | ||
| - name: Run update script | ||
| working-directory: ${{ github.workspace }}/tracked_game | ||
| shell: bash | ||
| run: ./update.sh | ||
| # Post-processing | ||
| - name: Set commit status | ||
| if: always() && steps.before.outputs.sha | ||
| id: set-status | ||
| working-directory: ${{ github.workspace }}/tracked_game | ||
| shell: bash | ||
| run: | | ||
| NEW_SHA=$(git rev-parse HEAD) | ||
| echo "sha=$NEW_SHA" >> $GITHUB_OUTPUT | ||
| if [[ "$NEW_SHA" == "${{ steps.before.outputs.sha }}" ]]; then | ||
| echo "No new commit was pushed, skipping status" | ||
| exit 0 | ||
| fi | ||
| if [[ "${{ job.status }}" == "success" ]]; then | ||
| STATE="success" | ||
| else | ||
| STATE="failure" | ||
| fi | ||
| gh api "repos/${{ github.repository }}/statuses/$NEW_SHA" \ | ||
| -f state="$STATE" \ | ||
| -f target_url="$GITHUB_SERVER_URL/${{ github.repository }}/actions/runs/${{ github.run_id }}" \ | ||
| -f description="GameTracking" \ | ||
| -f context="GameTracking" | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| - name: Checkout DumpS2 JSON Repo | ||
| if: ${{ inputs.dumpsource2-schema-json != '' }} | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| fetch-depth: 1 | ||
| path: dumps2_json | ||
| repository: 'ValveResourceFormat/SchemaExplorer' | ||
| token: ${{ secrets.DUMPSOURCE2_EXPLORER_TOKEN }} | ||
| - name: Push updated DumpSource2 JSON | ||
| if: ${{ inputs.dumpsource2-schema-json != '' }} | ||
| working-directory: ${{ github.workspace }}/dumps2_json/schemas | ||
| shell: bash | ||
| run: "${{ github.workspace }}/tools/push_schema_json.sh" "${{ inputs.dumpsource2-schema-json }}" "${{ github.workspace }}/tracked_game" "https://github.com/${{ github.repository }}/commit/${{ steps.set-status.outputs.sha }}" | ||
| - name: Dispatch sync to ValveProtobufs | ||
| if: ${{ env.GH_TOKEN != '' }} | ||
| run: gh api repos/SteamTracking/Protobufs/dispatches -f event_type=sync | ||
| env: | ||
| GH_TOKEN: ${{ secrets.DISPATCH_TOKEN }} | ||