ci(docs): auto-publish TypeDoc API reference to gh-pages (#158) #67
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: TypeDoc | |
| on: | |
| push: | |
| branches: [main] | |
| jobs: | |
| publish-docs: | |
| name: Generate & publish API docs | |
| runs-on: ubuntu-latest | |
| permissions: | |
| # peaceiris/actions-gh-pages needs write access to push to the gh-pages branch. | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: npm | |
| # Install deps (Prisma client is a peer of typedoc-plugin-* if ever added) | |
| - name: Install dependencies | |
| run: npm ci | |
| # Prisma generate is required so TypeDoc can resolve @prisma/client types | |
| # when it processes db.ts and other modules that import from it. | |
| - name: Generate Prisma client | |
| run: npx prisma generate | |
| # Regenerates docs/openapi.json, which is published alongside the | |
| # TypeDoc output. Dropping it would leave the hosted site with a stale | |
| # OpenAPI spec — silently, since nothing else reads that file. | |
| - name: Generate OpenAPI document | |
| run: npm run docs:openapi | |
| # TypeDoc writes to docs/api (see typedoc.json). It empties its output | |
| # directory first, so it must NOT point at docs/ itself — that is what | |
| # deleted docs/cookbook in an earlier revision of this PR. | |
| - name: Build TypeDoc HTML | |
| run: npx typedoc | |
| - name: Deploy to gh-pages | |
| uses: peaceiris/actions-gh-pages@v4 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ./docs | |
| # Overwrite only the docs output; keep any other files already on the branch. | |
| keep_files: true |