diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml new file mode 100644 index 0000000..d99b466 --- /dev/null +++ b/.github/workflows/pages.yml @@ -0,0 +1,66 @@ +name: Deploy docs to GitHub Pages + +on: + push: + branches: + - main + paths: + - "docs/**" + - ".github/workflows/pages.yml" + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: pages + cancel-in-progress: false + +jobs: + deploy: + runs-on: ubuntu-latest + permissions: + pages: write + id-token: write + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + steps: + - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 + with: + persist-credentials: false + - name: Install mdBook + uses: peaceiris/actions-mdbook@ee69d230fe19748b7abf22df32acaa93833fad08 # v2 + with: + mdbook-version: latest + - name: Install mdbook-mermaid + run: cargo install mdbook-mermaid + - name: Build en-US + run: mdbook build docs/en-US + - name: Build zh-CN + run: mdbook build docs/zh-CN + - name: Assemble site + run: | + rm -rf site_out + mkdir -p site_out/en-US site_out/zh-CN + cp -r docs/en-US/book/* site_out/en-US/ + cp -r docs/zh-CN/book/* site_out/zh-CN/ + cp -r docs/shared site_out/shared + cp docs/shared/og_preview.jpg site_out/og_preview.jpg + cp docs/shared/favicon.ico site_out/favicon.ico + cp docs/CNAME site_out/CNAME + cat > site_out/index.html <<'HTML' + + + termscp docs + + + termscp documentation + HTML + - name: Upload artifact + uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3 + with: + path: site_out + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4