Update website #8859
This file contains 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
# Simple workflow for deploying static content to GitHub Pages | |
name: Update website | |
on: | |
# Runs on pushes targeting the default branch | |
pull_request: | |
branches: ["main"] | |
schedule: | |
# Runs on UTC time so + 2 h for Warsaw | |
- cron: "*/15 5-18 * * *" | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | |
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | |
concurrency: | |
group: "update" | |
cancel-in-progress: false | |
env: | |
TOKEN: ${{ secrets.HOME_ASSISTANT_TOKEN }} | |
URL: ${{ secrets.HOME_ASSISTANT_URL }} | |
jobs: | |
# Run Python script to fetch REST API info | |
update: | |
runs-on: ubuntu-latest | |
permissions: | |
# Give the default GITHUB_TOKEN write permission to commit and push the | |
# added or changed files to the repository. | |
contents: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
# Push to protected branch | |
token: ${{ secrets.PAT }} | |
# Fetch all commits instead of a single, top one | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Generate files | |
run: python main.py | |
- name: Prepare deployment branch | |
run: | | |
git stash | |
git checkout gh-pages | |
git reset --hard origin/main | |
git stash pop | |
- name: Commit and push | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
commit_message: Update website | |
push_options: --force | |
branch: gh-pages |