Synchronize - Schema #224
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: Synchronize - Schema | |
| on: | |
| schedule: | |
| - cron: "0 8 * * *" | |
| workflow_dispatch: | |
| jobs: | |
| update-schema: | |
| runs-on: ubuntu-latest | |
| if: github.repository == 'roflmuffin/CounterStrikeSharp' | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: "8.0.x" | |
| - uses: denoland/setup-deno@v2 | |
| - name: Install lftp | |
| run: sudo apt-get update && sudo apt-get install -y lftp | |
| - name: Run schema update script | |
| env: | |
| GS_HOST: ${{ secrets.GS_HOST }} | |
| GS_PORT: ${{ secrets.GS_PORT }} | |
| GS_PASS: ${{ secrets.GS_PASS }} | |
| SFTP_HOST: ${{ secrets.SFTP_HOST }} | |
| SFTP_USER: ${{ secrets.SFTP_USER }} | |
| SFTP_PASS: ${{ secrets.SFTP_PASS }} | |
| run: | | |
| mkdir -p ~/.lftp | |
| echo "set sftp:auto-confirm yes" >> ~/.lftp/rc | |
| echo "set ssl:verify-certificate no" >> ~/.lftp/rc | |
| chmod +x eng/update-schema.ts | |
| chmod +x eng/rcon | |
| ./eng/update-schema.ts | |
| - name: Get patch version | |
| id: version | |
| run: | | |
| PATCH_VERSION=$(jq -r ".game_info.PatchVersion" managed/CounterStrikeSharp.SchemaGen/Schema/server.json) | |
| echo "patch_version=$PATCH_VERSION" >> $GITHUB_OUTPUT | |
| - name: Check for changes | |
| id: changes | |
| run: | | |
| if [[ -n $(git status --porcelain managed/CounterStrikeSharp.API/Generated/) ]]; then | |
| echo "has_changes=true" >> $GITHUB_OUTPUT | |
| echo "Changes detected in Generated folder:" | |
| git status --porcelain managed/CounterStrikeSharp.API/Generated/ | |
| else | |
| echo "has_changes=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Create Pull Request | |
| if: steps.changes.outputs.has_changes == 'true' | |
| uses: peter-evans/create-pull-request@v7 | |
| with: | |
| token: ${{ secrets.AUTOMATED_PR_PAT }} | |
| author: ${{ github.actor }} <${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com> | |
| commit-message: "chore: update schema definitions to ${{ steps.version.outputs.patch_version }}" | |
| title: "chore: Update Schema Definitions to ${{ steps.version.outputs.patch_version }}" | |
| body: | | |
| This PR was automatically generated by the schema update workflow. | |
| ## Changes | |
| - Updated schema definitions from the game server | |
| - Regenerated schema code using `CounterStrikeSharp.SchemaGen` | |
| - Patch Version: `${{ steps.version.outputs.patch_version }}` | |
| --- | |
| *This is an automated PR. Please review the changes before merging.* | |
| branch: chore/automated/schema-update | |
| delete-branch: true | |
| - name: No changes detected | |
| if: steps.changes.outputs.has_changes == 'false' | |
| run: echo "::notice::No schema changes detected. No PR will be created." |