55 lines
1.7 KiB
YAML
55 lines
1.7 KiB
YAML
# Simple workflow for deploying static content to GitHub Pages
|
|
name: Update website
|
|
|
|
on:
|
|
# Runs on pushes targeting the default branch
|
|
pull_request:
|
|
branches: ["master"]
|
|
|
|
# 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
|
|
|
|
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/master
|
|
git stash pop
|
|
- name: Commit and push
|
|
uses: stefanzweifel/git-auto-commit-action@v7.1.0
|
|
with:
|
|
commit_message: Update website
|
|
push_options: --force
|
|
branch: gh-pages
|