mirror of
https://github.com/orbbec/OrbbecSDK_ROS2.git
synced 2026-10-11 06:59:49 +08:00
ci: deploy docs with pages
This commit is contained in:
@@ -3,11 +3,19 @@ name: Deploy Docs
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
|
- docs/format_optimization
|
||||||
- Document
|
- Document
|
||||||
|
- main
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: read
|
||||||
|
pages: write
|
||||||
|
id-token: write
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: pages
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
@@ -15,19 +23,20 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
uses: actions/setup-python@v4
|
uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: "3.12"
|
python-version: "3.12"
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
python -m pip install --upgrade pip
|
python -m pip install --upgrade pip
|
||||||
pip install sphinx recommonmark sphinx-rtd-theme sphinx-markdown-tables
|
pip install -r docs/en/requirements.txt -r docs/zh/requirements.txt jieba
|
||||||
# 可选: 使用 myst-parser 代替 recommonmark
|
|
||||||
# pip install myst-parser
|
- name: Configure Pages
|
||||||
|
uses: actions/configure-pages@v5
|
||||||
|
|
||||||
- name: Build multilingual HTML
|
- name: Build multilingual HTML
|
||||||
run: |
|
run: |
|
||||||
@@ -36,16 +45,26 @@ jobs:
|
|||||||
# Build Chinese
|
# Build Chinese
|
||||||
sphinx-build -b html docs/zh docs/zh/_build/html
|
sphinx-build -b html docs/zh docs/zh/_build/html
|
||||||
# Merge outputs to unified publish directory
|
# Merge outputs to unified publish directory
|
||||||
mkdir -p docs/_build/html
|
mkdir -p site/en site/zh
|
||||||
cp -r docs/en/_build/html docs/_build/html/en
|
cp -r docs/en/_build/html/. site/en/
|
||||||
cp -r docs/zh/_build/html docs/_build/html/zh
|
cp -r docs/zh/_build/html/. site/zh/
|
||||||
# Root redirect to English (可根据需要改成 zh)
|
# Root redirect to English (可根据需要改成 zh)
|
||||||
echo '<!DOCTYPE html><html><head><meta http-equiv="refresh" content="0; url=en/index.html"></head><body>Redirecting...</body></html>' > docs/_build/html/index.html
|
echo '<!DOCTYPE html><html><head><meta http-equiv="refresh" content="0; url=en/index.html"></head><body>Redirecting...</body></html>' > site/index.html
|
||||||
|
touch site/.nojekyll
|
||||||
|
|
||||||
- name: Deploy to GitHub Pages
|
- name: Upload Pages artifact
|
||||||
uses: peaceiris/actions-gh-pages@v3
|
uses: actions/upload-pages-artifact@v3
|
||||||
with:
|
with:
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
path: site
|
||||||
publish_branch: gh-pages
|
|
||||||
publish_dir: docs/_build/html
|
|
||||||
|
|
||||||
|
deploy:
|
||||||
|
needs: build
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
environment:
|
||||||
|
name: github-pages
|
||||||
|
url: ${{ steps.deployment.outputs.page_url }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Deploy to GitHub Pages
|
||||||
|
id: deployment
|
||||||
|
uses: actions/deploy-pages@v4
|
||||||
|
|||||||
Reference in New Issue
Block a user