Update FEXCore #8
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 FEXCore | |
| on: | |
| schedule: | |
| - cron: '0 6 * * *' | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| update-fexcore: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install zstd | |
| run: sudo apt-get install -y zstd | |
| - name: Find latest FEXCore .wcp | |
| id: check | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: python3 tools/check-latest-fexcore.py | |
| - name: Download ${{ steps.check.outputs.LATEST_FILE }} | |
| if: steps.check.outputs.ALREADY_EXISTS == 'false' | |
| run: | | |
| curl -fL -o latest.wcp \ | |
| "https://raw.githubusercontent.com/StevenMXZ/Winlator-Contents/main/FEXCore/${{ steps.check.outputs.LATEST_FILE }}" | |
| - name: Convert .wcp → .tzst | |
| if: steps.check.outputs.ALREADY_EXISTS == 'false' | |
| run: | | |
| chmod +x tools/convert-wcp-to-tzst.sh | |
| ./tools/convert-wcp-to-tzst.sh latest.wcp "${{ steps.check.outputs.TZST_PATH }}" | |
| - name: Update arrays.xml | |
| if: steps.check.outputs.ALREADY_EXISTS == 'false' | |
| run: | | |
| python3 tools/update-arrays-xml.py \ | |
| app/src/main/res/values/arrays.xml \ | |
| "${{ steps.check.outputs.VERSION }}" | |
| - name: Create PR branch, commit, and open PR | |
| if: steps.check.outputs.ALREADY_EXISTS == 'false' | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| VERSION="${{ steps.check.outputs.VERSION }}" | |
| BRANCH="fexcore/update-${VERSION}" | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git checkout -b "$BRANCH" | |
| git add "${{ steps.check.outputs.TZST_PATH }}" | |
| git add app/src/main/res/values/arrays.xml | |
| git commit -m "chore: add FEXCore ${VERSION}" | |
| git push origin "$BRANCH" | |
| gh pr create \ | |
| --title "chore: add FEXCore ${VERSION}" \ | |
| --body "Automated update from [StevenMXZ/Winlator-Contents](https://github.com/StevenMXZ/Winlator-Contents/tree/main/FEXCore). | |
| - Converted \`${{ steps.check.outputs.LATEST_FILE }}\` → \`${{ steps.check.outputs.TZST_PATH }}\` | |
| - Added \`${VERSION}\` to \`fexcore_version_entries\` in \`arrays.xml\`" \ | |
| --head "$BRANCH" \ | |
| --base "$(git remote show origin | awk '/HEAD branch/ {print $NF}')" |