Skip to content

Update Version Files #35

Update Version Files

Update Version Files #35

Workflow file for this run

name: Update Version JSON Files
on:
schedule:
- cron: '0 */6 * * *' # Runs every 6 hours
workflow_dispatch: # Allows manual trigger
jobs:
update-json-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 JSON files
run: python update_json.py
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Setup git config
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
- name: Deploy to gh-pages
run: |
# Create temp directory and copy JSON files
mkdir -p /tmp/json-files
cp *.json /tmp/json-files/
# Switch to gh-pages branch
git fetch origin gh-pages
git checkout gh-pages || git checkout -b gh-pages
# Remove old JSON files and copy new ones
rm -f *.json
cp /tmp/json-files/*.json .
# Commit and push changes
git add *.json
git commit -m "Update version JSON files" || echo "No changes to commit"
git push origin gh-pages --force