Update Version Files #1227
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 Version Files | |
| on: | |
| schedule: | |
| - cron: '0 */6 * * *' # Runs every 6 hours | |
| workflow_dispatch: # Allows manual trigger | |
| jobs: | |
| update-files: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v2 | |
| with: | |
| fetch-depth: 0 # Fetch all history for all branches | |
| - name: Set up Python | |
| uses: actions/setup-python@v2 | |
| with: | |
| python-version: '3.x' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install requests | |
| - name: Update files | |
| run: python update_json.py | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Setup git config | |
| run: | | |
| git config --local user.email "action@github.com" | |
| git config --local user.name "GitHub Action" | |
| - name: Deploy to gh-pages | |
| run: | | |
| # Create temp directory and copy files | |
| mkdir -p /tmp/version-files | |
| cp *.json /tmp/version-files/ | |
| cp apparmor*.txt /tmp/version-files/ | |
| # Switch to gh-pages branch | |
| git fetch origin gh-pages | |
| git checkout gh-pages || git checkout -b gh-pages | |
| # Remove old files and copy new ones | |
| rm -f *.json apparmor*.txt | |
| cp /tmp/version-files/*.json . | |
| cp /tmp/version-files/apparmor*.txt . | |
| # Commit and push changes | |
| git add *.json apparmor*.txt | |
| git commit -m "Update version files" || echo "No changes to commit" | |
| git push origin gh-pages --force |