name: Pages
on:
push:
branches: [main, develop]
paths:
- "docs/**"
- ".github/workflows/pages.yml"
pull_request:
branches: [main, develop]
paths:
- "docs/**"
- ".github/workflows/pages.yml"
workflow_dispatch:
permissions:
contents: read
concurrency:
group: pages
cancel-in-progress: false
jobs:
build:
name: Build mdBook
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: taiki-e/install-action@mdbook
- name: Build English site
run: mdbook build docs/en
- name: Build Chinese site
run: mdbook build docs/zh
- name: Add language index
run: cp docs/index.html site/index.html
- name: Upload Pages artifact
if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
uses: actions/upload-pages-artifact@v4
with:
path: site
deploy:
name: Deploy GitHub Pages
if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
needs: build
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4