Sync Resource Directory #2
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: Sync Resource Directory | |
| on: | |
| schedule: | |
| - cron: '0 0 * * *' | |
| workflow_dispatch: | |
| jobs: | |
| sync-resource: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout prts-plus Repository | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: develop | |
| path: prts-plus | |
| ssh-key: ${{ secrets.RESOURCE_DEPLOY_KEY }} | |
| - name: Clone Specific Directories from ArknightsGameResource | |
| run: | | |
| git init temporary-repo | |
| cd temporary-repo | |
| git remote add origin https://github.com/yuanyan3060/ArknightsGameResource.git | |
| git config core.sparseCheckout true | |
| echo "avatar/*" >> .git/info/sparse-checkout | |
| git pull origin main | |
| cd .. | |
| mkdir -p prts-plus/resource/avatar | |
| cp -r temporary-repo/avatar/* prts-plus/resource/avatar/ | |
| - name: Clone Specific Files from MaaAssistantArknights | |
| run: | | |
| git init another-temp-repo | |
| cd another-temp-repo | |
| git remote add origin https://github.com/MaaAssistantArknights/MaaAssistantArknights.git | |
| git config core.sparseCheckout true | |
| echo "resource/Arknights-Tile-Pos/*" >> .git/info/sparse-checkout | |
| echo "resource/tasks.json" >> .git/info/sparse-checkout | |
| echo "resource/battle_data.json" >> .git/info/sparse-checkout | |
| git pull origin dev | |
| cd .. | |
| mkdir -p prts-plus/resource/map | |
| cp -r another-temp-repo/resource/Arknights-Tile-Pos/* prts-plus/resource/map/ | |
| cp another-temp-repo/resource/battle_data.json prts-plus/resource/ | |
| - name: Generate Mapping JSON | |
| run: | | |
| cd prts-plus | |
| python script/process_overview.py | |
| python script/process_battle_data.py | |
| - name: Setup Git User | |
| run: | | |
| cd prts-plus | |
| git config user.name "$GITHUB_ACTOR" | |
| git config user.email "$GITHUB_ACTOR@users.noreply.github.com" | |
| git show -s | |
| - name: Commit and Push Changes to prts-plus Repository | |
| run: | | |
| cd prts-plus | |
| echo "::group::Adding resources to Git" | |
| git add resource/ | |
| echo "::endgroup::" | |
| git diff --staged --quiet || git commit -m "Auto update resources from ArknightsGameResource and MaaAssistantArknights" | |
| git push origin develop |