mirror of
https://github.com/orbbec/OrbbecSDK_ROS2.git
synced 2026-10-05 20:47:46 +08:00
ci: deploy docs with pages
This commit is contained in:
@@ -3,11 +3,19 @@ name: Deploy Docs
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- docs/format_optimization
|
||||
- Document
|
||||
- main
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
contents: read
|
||||
pages: write
|
||||
id-token: write
|
||||
|
||||
concurrency:
|
||||
group: pages
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
build:
|
||||
@@ -15,19 +23,20 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.12"
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install sphinx recommonmark sphinx-rtd-theme sphinx-markdown-tables
|
||||
# 可选: 使用 myst-parser 代替 recommonmark
|
||||
# pip install myst-parser
|
||||
pip install -r docs/en/requirements.txt -r docs/zh/requirements.txt jieba
|
||||
|
||||
- name: Configure Pages
|
||||
uses: actions/configure-pages@v5
|
||||
|
||||
- name: Build multilingual HTML
|
||||
run: |
|
||||
@@ -36,16 +45,26 @@ jobs:
|
||||
# Build Chinese
|
||||
sphinx-build -b html docs/zh docs/zh/_build/html
|
||||
# Merge outputs to unified publish directory
|
||||
mkdir -p docs/_build/html
|
||||
cp -r docs/en/_build/html docs/_build/html/en
|
||||
cp -r docs/zh/_build/html docs/_build/html/zh
|
||||
mkdir -p site/en site/zh
|
||||
cp -r docs/en/_build/html/. site/en/
|
||||
cp -r docs/zh/_build/html/. site/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
|
||||
uses: peaceiris/actions-gh-pages@v3
|
||||
- name: Upload Pages artifact
|
||||
uses: actions/upload-pages-artifact@v3
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
publish_branch: gh-pages
|
||||
publish_dir: docs/_build/html
|
||||
path: site
|
||||
|
||||
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