Gate dispatch behind having a token #1
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 | ||
| folder: | ||
| 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 | ||
| secrets: | ||
| STEAM_USERNAME: | ||
| required: true | ||
| STEAM_PASSWORD: | ||
| required: true | ||
| DISPATCH_TOKEN: | ||
| required: false | ||
| jobs: | ||
| gametracking-setup: | ||
| runs-on: ${{ inputs.run-on-windows && 'windows-latest' || 'ubuntu-latest' }} | ||
| permissions: | ||
| contents: write | ||
| steps: | ||
| # Checkout and cache | ||
| - name: Checkout shared GameTracking | ||
| id: checkout-gametracking | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| fetch-depth: 1 | ||
| repository: 'SteamTracking/GameTracking' | ||
| - name: Restore tools cache | ||
| id: cache | ||
| uses: actions/cache@v5 | ||
| with: | ||
| path: | | ||
| ${{ github.workspace }}/tools/* | ||
| !${{ github.workspace }}/tools/build.sh | ||
| key: ${{ runner.os }}-tools-${{ steps.checkout-gametracking.outputs.commit }} | ||
| - name: Checkout game repository (${{ github.repository }}) | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| fetch-depth: 1 | ||
| path: ${{ inputs.folder }} | ||
| - name: Setup Go | ||
| if: steps.cache.outputs.cache-hit != 'true' | ||
| uses: actions/setup-go@v6 | ||
| with: | ||
| go-version: 'stable' | ||
| - name: Setup .NET | ||
| if: steps.cache.outputs.cache-hit != 'true' | ||
| uses: actions/setup-dotnet@v5 | ||
| with: | ||
| dotnet-version: '10.x' | ||
| - name: Build tools | ||
| if: steps.cache.outputs.cache-hit != 'true' | ||
| shell: bash | ||
| run: ./tools/build.sh | ||
| # Optional Node.js setup | ||
| - name: Check for package-lock.json | ||
| id: package-lock-json-exists | ||
| shell: bash | ||
| run: echo "exists=$(test -f ${{ github.workspace }}/${{ inputs.folder }}/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 }}/${{ inputs.folder }}/package-lock.json | ||
| - name: Install Node.js dependencies | ||
| if: steps.package-lock-json-exists.outputs.exists == 'true' | ||
| working-directory: ${{ github.workspace }}/${{ inputs.folder }} | ||
| 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" | ||
| - name: Download app ${{ inputs.appid }} | ||
| working-directory: ${{ github.workspace }}/${{ inputs.folder }} | ||
| 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 }}/${{ inputs.folder }} | ||
| shell: bash | ||
| run: ./update.sh | ||
| # Post-processing | ||
| - name: Dispatch sync to ValveProtobufs | ||
| if: ${{ secrets.DISPATCH_TOKEN }} | ||
| run: gh api repos/SteamTracking/Protobufs/dispatches -f event_type=sync | ||
| env: | ||
| GH_TOKEN: ${{ secrets.DISPATCH_TOKEN }} | ||