Add website update GitHub action
This commit is contained in:
parent
78782b6d93
commit
6ec6b5c7b9
5 changed files with 120 additions and 0 deletions
55
.github/workflows/update-website.yml
vendored
Normal file
55
.github/workflows/update-website.yml
vendored
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
# 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue