GitHub Pages Setup¶
This guide explains how to enable GitHub Pages for the documentation site.
Prerequisites¶
- Repository pushed to GitHub
- Admin access to repository settings
Setup Steps¶
1. Enable GitHub Pages¶
- Go to your repository on GitHub
- Click Settings (top menu)
- Scroll down to Pages (left sidebar)
- Under Build and deployment:
- Source: Select "GitHub Actions"
- (Don't select "Deploy from a branch")
2. Configure Permissions¶
The workflow requires write permissions to deploy:
- In repository Settings
- Go to Actions → General (left sidebar)
- Scroll to Workflow permissions
- Select Read and write permissions
- Check ✅ Allow GitHub Actions to create and approve pull requests
- Click Save
3. Trigger Deployment¶
The documentation will automatically deploy when:
- Changes are pushed to
mainbranch indocs/directory - Changes are made to
mkdocs.yml - Workflow is manually triggered
Manual Trigger:
- Go to Actions tab
- Click "Deploy Documentation" workflow
- Click Run workflow
- Select branch (usually
main) - Click Run workflow button
4. Verify Deployment¶
After the workflow completes (2-3 minutes):
- Go to Settings → Pages
- You should see: "Your site is live at https://bvandewe.github.io/cml-cloud-manager"
- Click the URL to view the documentation
Troubleshooting¶
Pages Not Enabled¶
Error: "GitHub Pages is not enabled for this repository"
Solution: Follow Step 1 above to enable Pages with "GitHub Actions" source
Permission Denied¶
Error: "Error: Unable to deploy" or "Permission denied"
Solution:
- Check workflow permissions (Step 2)
- Ensure you have admin access to the repository
Build Failed¶
Error: Workflow fails during build step
Solution:
- Check the workflow logs in Actions tab
- Verify
mkdocs.ymlis valid:make docs-build - Ensure all documentation files exist and are valid Markdown
Site Not Updating¶
Symptom: Changes not visible on GitHub Pages
Solution:
- Check if workflow completed successfully in Actions tab
- Hard refresh browser: Ctrl+Shift+R (Windows) or Cmd+Shift+R (Mac)
- Wait a few minutes for GitHub CDN to update
- Check if changes were pushed to
mainbranch
Custom Domain (Optional)¶
To use a custom domain:
- Go to Settings → Pages
- Under Custom domain, enter your domain
- Add DNS records as instructed
- Wait for DNS propagation (can take up to 48 hours)
Local Testing¶
Before pushing, test documentation locally:
# Install dependencies
make docs-install
# Serve locally
make docs-serve
# Build to verify
make docs-build
Visit http://127.0.0.1:8000 to preview.
Workflow Overview¶
The GitHub Actions workflow (.github/workflows/docs.yml):
- Build Job:
- Checks out code
- Installs Python 3.11
- Installs MkDocs dependencies
- Builds documentation with
mkdocs build --strict -
Uploads site artifact
-
Deploy Job (only on
mainpush): - Downloads build artifact
-
Deploys to GitHub Pages
-
PR Check Job (pull requests only):
- Builds documentation to verify
- Comments on PR with status
Updating Documentation¶
Local Changes¶
# Make changes to docs/*.md files
# Preview locally
make docs-serve
# Commit and push
git add docs/
git commit -m "docs: update documentation"
git push origin main
GitHub Actions will automatically deploy the changes.
Pull Request Workflow¶
- Create branch:
git checkout -b docs/my-changes - Make documentation changes
- Push:
git push origin docs/my-changes - Create pull request on GitHub
- Workflow will verify build succeeds
- After merge, documentation auto-deploys
Manual Deployment¶
To deploy from local machine (requires push access):
This uses mkdocs gh-deploy which:
- Builds documentation
- Creates/updates
gh-pagesbranch - Pushes to GitHub
Note: Manual deployment is not needed with GitHub Actions enabled.
Configuration Files¶
.github/workflows/docs.yml¶
GitHub Actions workflow for automatic deployment.
Triggers:
- Push to
mainwith changes indocs/ormkdocs.yml - Pull requests to
main(build check only) - Manual workflow dispatch
mkdocs.yml¶
MkDocs configuration file.
Key settings:
site_name: Documentation site titlesite_url: Published URL (update for custom domain)repo_url: Link to GitHub repositorynav: Documentation structuretheme: Material theme configuration
Makefile¶
Documentation commands:
make docs-install # Install MkDocs
make docs-serve # Local preview
make docs-build # Build site
make docs-deploy # Manual deploy
make docs-clean # Clean build artifacts
URLs¶
- Live Site: https://bvandewe.github.io/cml-cloud-manager
- Repository: https://github.com/bvandewe/cml-cloud-manager
- Workflow: https://github.com/bvandewe/cml-cloud-manager/actions/workflows/docs.yml
Support¶
If you encounter issues:
- Check Troubleshooting section above
- Review GitHub Actions logs in the Actions tab
- Test documentation build locally
- Check MkDocs documentation
- Check GitHub Pages documentation