This guide explains how to set up automatic documentation deployment to GitHub Pages using GitHub Actions, integrating both MkDocs and Dokka API documentation.
- Go to your repository on GitHub
- Navigate to Settings → Pages
- Under Source, select GitHub Actions
- Save the settings
The documentation system combines:
- MkDocs: Main documentation site with guides, tutorials, and examples
- Dokka: API documentation automatically generated from code comments
- Integration: API docs are served under
/api/0.x/path within the MkDocs site
We've provided two workflow options:
- ✅ Generates MkDocs site with integrated API docs
- ✅ Builds Dokka API documentation
- ✅ Deploys combined site to GitHub Pages
- ✅ Simple and reliable
- ✅ All features from simple workflow
- ✅ Version information in documentation
- ✅ PR preview artifacts
- ✅ Tag-based releases
- ✅ Automatic PR comments
Choose one workflow - delete the other to avoid conflicts.
Ensure your repository has the correct permissions:
- Go to Settings → Actions → General
- Under Workflow permissions, select:
- ✅ Read and write permissions
- ✅ Allow GitHub Actions to create and approve pull requests
After setup, your documentation will be available at:
https://<username>.github.io/<repository-name>/
API documentation will be available at:
https://<username>.github.io/<repository-name>/api/0.x/
For the Transmission library:
Main site: https://trendyol.github.io/transmission/
API docs: https://trendyol.github.io/transmission/api/0.x/
To build the complete documentation site locally:
# Install MkDocs and dependencies
pip install mkdocs-material pymdown-extensions
# Generate API documentation
./gradlew generateApiDocs
# Build the complete site
mkdocs build
# Serve locally for development
mkdocs serveThe combined site will be available at http://localhost:8000 with API docs at http://localhost:8000/api/0.x/.
docs/ # MkDocs documentation
├── index.md # Main documentation
├── api-overview.md # API overview (included in Dokka)
└── ...
build/site/ # Generated documentation site
├── index.html # MkDocs main page
├── api/0.x/ # Dokka API documentation
│ ├── index.html # API documentation entry point
│ └── ...
└── ...
- Automatic Generation: Runs on every push to main/master
- Manual Trigger: Can be triggered manually from Actions tab
- MkDocs + Dokka Integration: Builds both documentation types
- Gradle Caching: Faster builds with Gradle caching
- Error Handling: Detailed error reporting with stacktraces
- Version Display: Shows version info in documentation
- PR Previews: Generates documentation artifacts for pull requests
- Release Tagging: Special handling for version tags
- PR Comments: Automatic comments on PRs with download links
- Build Metadata: Commit hash and build timestamp
The API documentation is versioned using the apiVersion variable in build.gradle.kts:
val apiVersion = "0.x" // Update this for different versionsWhen you create a tag (e.g., v1.0.0):
git tag v1.0.0
git push origin v1.0.0The documentation will show version information and API docs will be available under the appropriate version path.
To customize the documentation generation, edit the tasks in build.gradle.kts:
tasks.register("generateApiDocs") {
group = "documentation"
description = "Generates API documentation for all Transmission modules"
dependsOn("dokkaHtmlMultiModule")
}You can add custom markdown files to be included in the documentation:
- Create
.mdfiles in thedocs/directory - Add them to the
navsection inmkdocs.yml - They'll be included in the next build
The navigation is configured in mkdocs.yml. The API link is automatically included:
nav:
- 'Introduction': index.md
- 'How To Use': 'how_to_use.md'
# ... other pages
- 'API': 'api/0.x/' # Points to Dokka API docs-
API documentation not found
- Ensure
generateApiDocstask completes successfully - Check that Dokka is properly configured for all modules
- Verify the API version path matches in navigation
- Ensure
-
MkDocs build failures
- Check that all referenced markdown files exist
- Verify navigation structure in
mkdocs.yml - Ensure required Python packages are installed
-
404 Page Not Found
- Ensure GitHub Pages is enabled
- Check that the workflow completed successfully
- Wait a few minutes for deployment
Run locally to test:
# Generate API documentation only
./gradlew generateApiDocs
# Build complete site
mkdocs build
# Serve locally
mkdocs serve
# Check generated structure
find build/site -name "*.html" | head -10Monitor your documentation builds:
- Go to Actions tab in your repository
- Click on Generate and Deploy Documentation
- View build logs and deployment status
Check deployment status:
- Go to Settings → Pages
- View deployment history
- Check for any errors or warnings
Keep your workflows updated:
- Update action versions quarterly
- Monitor for deprecated features
- Test workflows with new Gradle/Java versions
- Update MkDocs and Python dependencies
- Workflows use minimal required permissions
- No secrets are exposed in documentation
- All actions use official, maintained versions