This document explains how to set up automatic documentation deployment to Netlify when merging to master or when using the "docs" label on pull requests.
The project uses GitHub Actions to automatically build and deploy documentation to Netlify in two scenarios:
- Production Deployment: When changes are merged to the master branch
- Preview Deployment: When a pull request has the "docs" label
The documentation is generated using TypeDoc and includes API documentation, coverage reports, and interactive navigation.
- Automatically triggers on pushes to
masterormainbranches - Deploys to the production Netlify site
- Updates the main documentation URL
- Triggers on pull requests with the "docs" label
- Creates a preview deployment for testing documentation changes
- Adds a comment to the PR with the preview URL
- Perfect for reviewing documentation changes before merging
- Create a pull request with documentation changes
- Add the "docs" label to the pull request
- The workflow will automatically build and deploy a preview
- Check the PR comments for the preview URL
- Review the changes and merge when ready
- Go to Netlify and sign in
- Create a new site (or use an existing one)
- Note down your Site ID from the site settings
- Generate a Personal Access Token:
- Go to User Settings → Applications → Personal access tokens
- Create a new token with appropriate permissions
Add the following secrets to your GitHub repository:
-
Go to your repository → Settings → Secrets and variables → Actions
-
Add these repository secrets:
NETLIFY_AUTH_TOKEN: Your Netlify personal access tokenNETLIFY_SITE_ID: Your Netlify site ID
The deployment workflow is configured in .github/workflows/deploy-docs.yml and will:
- Trigger on pushes to
masterandmainbranches (production) - Trigger on pull requests with the "docs" label (preview)
- Build documentation using
yarn docs - Deploy the generated docs to Netlify
- Add appropriate comments with deployment status
The netlify.toml file configures:
- Publish directory (
docs) - Redirect rules for better navigation
- Cache headers for static assets
- Security headers
You can manually trigger documentation deployment by:
- Going to Actions tab in your GitHub repository
- Selecting "Deploy Documentation to Netlify" workflow
- Clicking "Run workflow"
To build documentation locally:
# Install dependencies
yarn install
# Generate documentation
yarn docs
# View documentation (served from ./docs directory)
# You can use any static file server, for example:
npx serve docs- Build fails: Check that all dependencies are installed and TypeDoc configuration is correct
- Deployment fails: Verify Netlify secrets are correctly set in GitHub repository settings
- Missing documentation: Ensure TypeDoc is properly configured in
typedoc.config.mjs - Preview not deploying: Make sure the "docs" label is added to the pull request
- View deployment logs in GitHub Actions
- Check Netlify dashboard for deployment status
- Review commit/PR comments for deployment notifications
The generated documentation includes:
- API reference for all exported functions and classes
- Type definitions and interfaces
- Coverage reports (if configured)
- Interactive navigation and search
- External links to React documentation