name: Deploy Docs on: push: branches: - docs/format_optimization - Document - main workflow_dispatch: permissions: contents: read pages: write id-token: write concurrency: group: pages cancel-in-progress: true jobs: build: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v5 with: python-version: "3.12" - name: Install dependencies run: | python -m pip install --upgrade pip 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: | # Build English sphinx-build -b html docs/en docs/en/_build/html # Build Chinese sphinx-build -b html docs/zh docs/zh/_build/html # Merge outputs to unified publish directory 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 '
Redirecting...' > site/index.html touch site/.nojekyll - name: Upload Pages artifact uses: actions/upload-pages-artifact@v3 with: 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