Check and Update Releases #12
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: Check and Update Releases | |
| on: | |
| schedule: | |
| - cron: '0 0 * * *' # Runs daily at midnight UTC | |
| workflow_dispatch: # Allows manual trigger | |
| jobs: | |
| check-releases: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| # Step 1: Check and update badges.json on gh-pages | |
| - name: Switch to gh-pages branch | |
| run: git checkout gh-pages | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: '18' | |
| - name: Install dependencies | |
| run: npm install axios | |
| - name: Check and update badges.json | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: node check-releases.js --badges-only | |
| - name: Commit and push badges.json changes | |
| run: | | |
| git config --local user.name "GitHub Actions Bot" | |
| git config --local user.email "[email protected]" | |
| git add badges.json | |
| git commit -m "Update badges.json with latest release URLs" || echo "No changes to commit for badges.json" | |
| git push origin gh-pages | |
| # Step 2: Switch to main branch and update README.md | |
| - name: Switch to main branch | |
| run: git checkout main | |
| - name: Copy updated badges.json from gh-pages | |
| run: git checkout gh-pages -- badges.json | |
| - name: Update README.md | |
| run: node check-releases.js --readme-only | |
| - name: Commit and push README.md changes | |
| run: | | |
| git config --local user.name "GitHub Actions Bot" | |
| git config --local user.email "[email protected]" | |
| git add README.md | |
| git commit -m "Update README.md with updated GitHub download links" || echo "No changes to commit for README.md" | |
| git push origin main |