name: Documentation
on:
push:
branches: [ main, master ]
paths: ['docs/**', '*.md', 'src/**/*.ts', 'src/**/*.js']
pull_request:
paths: ['docs/**', '*.md', 'src/**/*.ts', 'src/**/*.js']
jobs:
build-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Generate TypeDoc
run: |
if [ -f "tsconfig.json" ]; then
npx typedoc --out docs/api src --theme minimal
fi
- name: Build docs site
run: |
if [ -f "docs/package.json" ]; then
cd docs && npm ci && npm run build
fi
- name: Deploy to GitHub Pages
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs
force_orphan: true