add doc ci (#54)

This commit is contained in:
Wei Fu 2025-05-28 20:01:10 +08:00 committed by GitHub
parent 7826fdbb87
commit d13b517cbf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 57 additions and 0 deletions

57
.github/workflows/deploy-docs.yml vendored Normal file
View File

@ -0,0 +1,57 @@
name: Deploy Jupyter Book to GitHub Pages
on:
push:
branches: [ main ] # Change to your default branch if different
pull_request:
branches: [ main ]
# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true
# Sets permissions of the GITHUB_TOKEN
permissions:
contents: read
pages: write
id-token: write
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9' # Adjust version as needed
- name: Cache pip dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install jupyter-book ghp-import
# Install additional dependencies if you have a requirements.txt
# pip install -r requirements.txt
- name: Build the book
run: |
jupyter-book build docs
- name: Deploy to GitHub Pages
if: github.ref == 'refs/heads/main' # Only deploy on main branch
run: |
ghp-import -n -p -f docs/_build/html
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}