Documentation Deployment
This guide explains how to set up automatic deployment of MkDocs documentation to GitHub Pages.
Automatic Deployment with GitHub Actions
The documentation is automatically built and deployed on every push to the main or master branch.
Initial Setup
- Enable GitHub Pages:
- Go to your repository on GitHub
- Navigate to Settings → Pages
- Under Source, select GitHub Actions
-
Save the changes
-
Push to trigger deployment:
-
Verify deployment:
- Go to Actions tab in your repository
- You should see "Deploy Documentation" workflow running
- Once complete, your docs will be available at:
https://your-username.github.io/tradingbot25/
Manual Deployment
You can also trigger deployment manually:
- Go to Actions tab
- Select Deploy Documentation workflow
- Click Run workflow
- Select branch and click Run workflow
Workflow Details
The GitHub Actions workflow (.github/workflows/docs.yml) does the following:
- Checks out the repository
- Sets up Python 3.12 and
uv - Installs dependencies including MkDocs and plugins
- Builds documentation using
mkdocs build - Deploys to GitHub Pages automatically
Troubleshooting
Documentation not appearing
- Check GitHub Pages settings:
- Ensure "GitHub Actions" is selected as the source
-
Check that the workflow has completed successfully
-
Check workflow logs:
- Go to Actions tab
- Click on the latest workflow run
-
Review logs for any errors
-
Common issues:
- Build failures: Check that all dependencies are in
pyproject.tomlunder[project.optional-dependencies.docs] - Import errors: Ensure
tradingbotmodule can be imported (check Python path) - Missing files: Verify all markdown files referenced in
mkdocs.ymlexist
Update repository URL
If your repository URL changes, update mkdocs.yml:
Local Testing
Before pushing, test the build locally:
# Install dependencies
uv sync --extra docs
# Build documentation
uv run mkdocs build
# Check for errors
# Output should be in ./site directory
Custom Domain (Optional)
To use a custom domain:
-
Add a
CNAMEfile todocs/directory: -
Configure DNS:
-
Add a CNAME record pointing to
your-username.github.io -
Update GitHub Pages settings:
- Go to Settings → Pages
- Enter your custom domain