GitHub Pages Deployment Guide¶
This guide explains how to deploy the TrueLedger documentation to GitHub Pages.
🚀 Automatic Deployment (Recommended)¶
The documentation is automatically deployed to GitHub Pages whenever changes are pushed to the main branch.
How It Works¶
- Trigger: Push to
mainbranch with changes todocs/ormkdocs.yml - Build: GitHub Actions builds the documentation using MkDocs
- Deploy: The built site is deployed to the
gh-pagesbranch - Live: Documentation is available at https://satyakommula96.github.io/trueledger/
Workflow File¶
The deployment is handled by .github/workflows/deploy-docs.yml:
name: Deploy Documentation
on:
push:
branches:
- main
paths:
- 'docs/**'
- 'mkdocs.yml'
workflow_dispatch: # Manual trigger option
Manual Trigger¶
You can also manually trigger the deployment from GitHub:
- Go to Actions tab in GitHub
- Select Deploy Documentation workflow
- Click Run workflow
- Select
mainbranch - Click Run workflow
🔧 One-Time Setup¶
1. Enable GitHub Pages¶
- Go to your repository on GitHub
- Navigate to Settings → Pages
- Under Source, select:
- Branch:
gh-pages - Folder:
/ (root) - Click Save
2. Configure Permissions¶
The workflow needs write permissions to deploy:
- Go to Settings → Actions → General
- Scroll to Workflow permissions
- Select Read and write permissions
- Click Save
3. First Deployment¶
After setup, trigger the first deployment:
# Option 1: Push to main
git add .
git commit -m "docs: setup GitHub Pages deployment"
git push origin main
# Option 2: Manual deployment (see below)
💻 Manual Deployment (Local)¶
You can also deploy manually from your local machine:
Prerequisites¶
Deploy¶
# Build and deploy to GitHub Pages
mkdocs gh-deploy
# With custom commit message
mkdocs gh-deploy -m "docs: update documentation"
This will:
1. Build the documentation
2. Push to gh-pages branch
3. Make it live at https://satyakommula96.github.io/trueledger/
🔍 Verify Deployment¶
Check Build Status¶
- Go to Actions tab
- Find the latest Deploy Documentation workflow run
- Check if it completed successfully (green checkmark)
View Live Site¶
Visit: https://satyakommula96.github.io/trueledger/
Check gh-pages Branch¶
🛠️ Troubleshooting¶
Deployment Fails¶
Problem: Workflow fails with permission error
Solution: 1. Check Settings → Actions → General 2. Ensure Read and write permissions is selected
Problem: Pages not updating
Solution: 1. Check if workflow ran successfully in Actions tab 2. Clear browser cache 3. Wait a few minutes for GitHub Pages to update
Problem: 404 error on GitHub Pages
Solution:
1. Verify Settings → Pages source is set to gh-pages branch
2. Check that site_url in mkdocs.yml matches your GitHub Pages URL
3. Ensure the workflow completed successfully
Build Errors¶
Problem: MkDocs build fails
Solution:
1. Test locally first: mkdocs build --strict
2. Fix any broken links or missing files
3. Check mkdocs.yml for syntax errors
Custom Domain¶
To use a custom domain (e.g., docs.trueledger.app):
-
Create
docs/CNAMEfile: -
Configure DNS:
-
Add CNAME record pointing to
satyakommula96.github.io -
Update
mkdocs.yml: -
In GitHub Settings → Pages, add custom domain
📋 Deployment Checklist¶
Before deploying:
- [ ] All documentation pages are complete
- [ ] Links are working (
mkdocs build --strict) - [ ] Images and assets are included
- [ ] Navigation structure is correct in
mkdocs.yml - [ ] GitHub Pages is enabled in repository settings
- [ ] Workflow permissions are set correctly
🔄 Workflow Details¶
Triggers¶
The workflow runs when:
- Changes pushed to main branch affecting:
- docs/** (any documentation file)
- mkdocs.yml (configuration)
- .github/workflows/deploy-docs.yml (workflow itself)
- Manually triggered via GitHub Actions UI
Steps¶
- Checkout: Fetches repository code
- Setup Python: Installs Python 3.x
- Cache: Caches pip packages for faster builds
- Install: Installs MkDocs and plugins
- Build: Builds documentation with
--strictflag - Deploy: Pushes to
gh-pagesbranch
Build Time¶
Typical build time: 1-2 minutes
Caching¶
Dependencies are cached to speed up builds. Cache is invalidated when requirements.txt changes.
📊 Monitoring¶
View Deployment History¶
- Go to Actions tab
- Filter by Deploy Documentation workflow
- View all past deployments
Analytics (Optional)¶
To add Google Analytics:
- Get your GA tracking ID
- Update
mkdocs.yml:
🎯 Best Practices¶
- Test Locally: Always run
mkdocs servebefore pushing - Strict Mode: Use
mkdocs build --strictto catch errors - Commit Messages: Use conventional commits (e.g.,
docs: update installation guide) - Review Changes: Preview changes locally before deploying
- Incremental Updates: Deploy small, frequent updates rather than large batches
📚 Resources¶
Your documentation is now set up for automatic deployment! 🎉
Every push to main will automatically update your live documentation site.