Run Demo Builds #6403
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: Run Demo Builds | |
| on: | |
| schedule: | |
| - cron: '*/50 * * * *' # every 50 minutes | |
| workflow_call: | |
| inputs: | |
| build-run-id: | |
| description: 'The run ID of the build workflow that created the artifacts' | |
| required: false | |
| type: string | |
| workflow_dispatch: | |
| workflow_run: | |
| workflows: ["Build Sentaur Survivors"] | |
| types: | |
| - completed | |
| jobs: | |
| run-windows: | |
| name: Run Windows Build | |
| runs-on: windows-latest | |
| steps: | |
| - name: Set run ID | |
| # Setting the run-ID this way to allow the scheduled run to take from 'main' but also run the demo from a branch | |
| id: get-run | |
| run: | | |
| if ("${{ inputs.build-run-id }}" -ne "") { | |
| echo "run-id=${{ inputs.build-run-id }}" >> $env:GITHUB_OUTPUT | |
| } else { | |
| $runs = Invoke-RestMethod -Uri "https://api.github.com/repos/${{ github.repository }}/actions/workflows/ci.yml/runs?branch=main&status=success&per_page=1" -Headers @{Authorization="Bearer ${{ secrets.GITHUB_TOKEN }}"} | |
| $runId = $runs.workflow_runs[0].id | |
| echo "run-id=$runId" >> $env:GITHUB_OUTPUT | |
| } | |
| - name: Download Build | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: SentaurSurvivors-StandaloneWindows64 | |
| path: ./build | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| repository: ${{ github.repository }} | |
| run-id: ${{ steps.get-run.outputs.run-id }} | |
| - name: Run Build | |
| timeout-minutes: 10 | |
| env: | |
| SENTRY_DSN: ${{ secrets.DSN }} | |
| run: | | |
| $exePath = Get-ChildItem -Path "./build" -Filter "SentaurSurvivors-*.exe" -Recurse | Select-Object -First 1 | |
| if ($exePath) | |
| { | |
| Write-Output "Found executable: $($exePath.FullName)" | |
| $startTime = Get-Date | |
| Start-Process -FilePath $exePath -ArgumentList "-demo" -Wait -PassThru -NoNewWindow | |
| $endTime = Get-Date | |
| $duration = $endTime - $startTime | |
| Write-Output "Game finished in $($duration.ToString('hh\:mm\:ss'))" | |
| $logPath = "$env:USERPROFILE\AppData\LocalLow\Sentry\SentaurSurvivors\Player.log" | |
| if (Test-Path $logPath) | |
| { | |
| Write-Output "::group::Game Logs" | |
| Get-Content $logPath | |
| Write-Output "::endgroup::" | |
| } | |
| else | |
| { | |
| Write-Output "Unity log file not found at: $logPath" | |
| } | |
| Write-Output "Run executed successfully" | |
| } | |
| else | |
| { | |
| Write-Error "No SentaurSurvivors executable found in build artifacts" | |
| exit 1 | |
| } |