[CI] Fix doc CI again (#57)

* .

* .

* .

* .

* .

* .
This commit is contained in:
Wei Fu 2025-05-29 11:22:27 +08:00 committed by GitHub
parent 409fa9842d
commit b3375607c6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 47 additions and 33 deletions

View File

@ -18,41 +18,55 @@ permissions:
id-token: write
jobs:
build-and-deploy:
# Build job
build:
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.12' # Adjust version as needed
- name: Checkout
uses: actions/checkout@v4
- 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: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.12'
- 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: 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
# Install additional dependencies if you have a requirements.txt
# pip install -r requirements.txt
- name: Build the book
run: |
jupyter-book build docs
- name: Setup Pages
uses: actions/configure-pages@v4
- 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: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git remote set-url origin https://x-access-token:${{ secrets.DEPLOY_TOKEN }}@github.com/${{ github.repository }}.git
ghp-import -n -p -f docs/_build/html
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: docs/_build/html
# Deployment job
deploy:
# Only deploy on push to main, not on PRs
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4