Skip to content

update doc

update doc #5

name: Trigger GH-Pages Deploy Docs
on:
push:
paths:
- 'docs/**'
- 'mkdocs.yml'
workflow_dispatch:
permissions:
contents: write
env:
DEPLOY_BRANCH: docs
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- 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: Build artifact
run: mkdocs build --site-dir site
- name: Copy artifact to a branch
run: |
git config --local user.name "github-actions[bot]"
git config --local user.email "github-actions[bot]@users.noreply.github.com"
# Create or switch to the deploy branch
git checkout --orphan ${{ env.DEPLOY_BRANCH }}
# Remove all files in the current branch
# except .git, site and the current dir
find . -maxdepth 1 ! -name site ! -name .git ! -name . -exec rm -rf {} \;
# move out contents in site folder
mv site/* .
rmdir site
# Add and commit changes
git add .
git commit -m "Deploy updated documentation"
# Force push to the deploy branch, replacing history
git push --force --set-upstream origin ${{ env.DEPLOY_BRANCH }}