Update Version Files #6
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 JSON Files | |
| on: | |
| schedule: | |
| - cron: '0 */6 * * *' # Run every 6 hours | |
| workflow_dispatch: # Allow manual trigger | |
| jobs: | |
| update-json: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Create temp directory and download files | |
| run: | | |
| mkdir -p /tmp/ha-files | |
| cd /tmp/ha-files | |
| curl -o stable.json https://version.home-assistant.io/stable.json | |
| curl -o beta.json https://version.home-assistant.io/beta.json | |
| sed -i 's|https://os-artifacts.home-assistant.io/|https://github.com/ameriDroid/HA-operating-system/releases/download/|g' stable.json beta.json | |
| - name: Setup git config | |
| run: | | |
| git config --global user.name "GitHub Actions Bot" | |
| git config --global user.email "<>" | |
| - name: Switch to gh-pages and update | |
| run: | | |
| git fetch origin gh-pages | |
| git checkout gh-pages || git checkout -b gh-pages | |
| git rm -rf . | |
| cp /tmp/ha-files/* . | |
| cp $GITHUB_WORKSPACE/index.html . | |
| git add . | |
| git commit -m "Update JSON files" | |
| git push origin gh-pages --force |