Update BSATN game data #4125
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: Update BSATN game data | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: '42 * * * *' | |
| jobs: | |
| bsatn: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Update bindings | |
| run: | |
| git submodule update --init --remote scripts/bsatn/bindings | |
| - name: Checkout game data repo | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: BitCraftToolBox/BitCraft_BSATN_Data | |
| path: workspace/data/bsatn | |
| token: ${{ secrets.ACTIONS_TOKEN }} | |
| - name: Set up Nodejs | |
| uses: actions/setup-node@v4 | |
| with: | |
| cache: 'npm' | |
| cache-dependency-path: 'scripts/bsatn/' | |
| - name: Install dependencies | |
| run: npm ci | |
| working-directory: scripts/bsatn | |
| - name: Remove old data | |
| run: rm -rf workspace/data/bsatn/static/* | |
| - name: Run data script | |
| id: update-data | |
| env: | |
| BITCRAFT_SPACETIME_HOST: ${{ secrets.BITCRAFT_SPACETIME_HOST }} | |
| BITCRAFT_GLOBAL_MODULE: ${{ secrets.BITCRAFT_GLOBAL_MODULE }} | |
| BITCRAFT_REGION_MODULE: ${{ secrets.BITCRAFT_REGION_MODULE }} | |
| BITCRAFT_BEARER_TOKEN: ${{ secrets.BITCRAFT_BEARER_TOKEN }} | |
| DATA_DIR: ${{ github.workspace }}/workspace/data/bsatn/static | |
| run: npm exec tsx gamedata-bsatn.ts | |
| working-directory: scripts/bsatn | |
| - name: Commit changes | |
| if: steps.update-data.outputs.updated_data == 'true' | |
| run: | | |
| cd workspace/data/bsatn | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git add -A | |
| if ! git diff --cached --quiet; then | |
| git commit -m "Update game data: $(date +%Y-%m-%d)" | |
| git push origin main | |
| fi | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.ACTIONS_TOKEN }} |