docs: publish VitePress documentation on GitHub Pages

This commit is contained in:
morluto committed 2026-10-07 16:58:04 +08:00
1 parent eab34a9d8c
commit c78fe6990b
17 files changed
+2817 -21

No files matched your search

+63
View File
@@ -0,0 +1,63 @@
name: Documentation site
on:
push:
branches: [main]
paths:
- "docs/**"
- "package.json"
- "package-lock.json"
- ".nvmrc"
- ".github/workflows/pages.yml"
pull_request:
branches: [main]
paths:
- "docs/**"
- "package.json"
- "package-lock.json"
- ".nvmrc"
- ".github/workflows/pages.yml"
workflow_dispatch:
permissions:
contents: read
concurrency:
group: pages-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
env:
HUSKY: "0"
jobs:
build:
name: Build documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: npm
- run: npm ci
- run: npm run docs:build
- uses: actions/upload-pages-artifact@v4
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
with:
path: docs/.vitepress/dist
deploy:
name: Publish documentation
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
needs: build
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/configure-pages@v5
- uses: actions/deploy-pages@v4
id: deployment