mirror of
https://github.com/openmlsys/openmlsys-zh.git
synced 2026-03-31 09:20:50 +08:00
Use mdbook-katex in pre-render mode for both books, pin mdBook to a compatible version, update build scripts and workflows, and replace the old MathJax regression tests with KaTeX coverage.
81 lines
2.1 KiB
YAML
81 lines
2.1 KiB
YAML
name: Deploy Docs
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
pages: write
|
|
id-token: write
|
|
|
|
concurrency:
|
|
group: github-pages
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
|
|
- id: pages
|
|
uses: actions/configure-pages@v5
|
|
|
|
- name: Set up Python 3.10
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.10'
|
|
|
|
- name: Setup mdBook
|
|
uses: peaceiris/actions-mdbook@v2
|
|
with:
|
|
mdbook-version: '0.4.48'
|
|
|
|
- name: Install mdBook KaTeX
|
|
run: cargo install mdbook-katex --locked
|
|
|
|
- name: Run mdBook regression tests
|
|
run: |
|
|
python3 -m unittest discover -s tests -p 'test_prepare_mdbook.py'
|
|
python3 -m unittest discover -s tests -p 'test_prepare_mdbook_zh.py'
|
|
python3 -m unittest discover -s tests -p 'test_assemble_docs_publish_tree.py'
|
|
python3 -m unittest discover -s tests -p 'test_ensure_book_resources.py'
|
|
python3 -m unittest discover -s tests -p 'test_mdbook_katex.py'
|
|
python3 -m unittest discover -s tests -p 'test_mdbook_katex_config.py'
|
|
|
|
- name: Build English HTML with mdBook
|
|
run: bash build_mdbook.sh
|
|
|
|
- name: Build Chinese HTML with mdBook
|
|
run: bash build_mdbook_zh.sh
|
|
|
|
- name: Assemble GitHub Pages artifact
|
|
env:
|
|
DEPLOY_TARGET_URL: ${{ steps.pages.outputs.base_url }}
|
|
run: |
|
|
echo "Deploy target: ${DEPLOY_TARGET_URL}" >> "$GITHUB_STEP_SUMMARY"
|
|
|
|
python3 tools/assemble_docs_publish_tree.py \
|
|
--destination-root _site \
|
|
--docs-subdir . \
|
|
--en-source .mdbook/book \
|
|
--zh-source .mdbook-zh/book
|
|
|
|
- name: Upload GitHub Pages artifact
|
|
uses: actions/upload-pages-artifact@v4
|
|
with:
|
|
path: _site
|
|
|
|
deploy:
|
|
needs: build
|
|
runs-on: ubuntu-latest
|
|
environment:
|
|
name: github-pages
|
|
url: ${{ steps.deployment.outputs.page_url }}
|
|
steps:
|
|
- id: deployment
|
|
uses: actions/deploy-pages@v4
|