GitHub Pages Setup Guide
This guide explains how to enable GitHub Pages for the Bindy documentation.
Prerequisites
- Repository must be pushed to GitHub
- You must have admin access to the repository
- The
.github/workflows/docs.yamlworkflow file must be present
Setup Steps
1. Enable GitHub Pages
- Go to your repository on GitHub: https://github.com/firestoned/bindy
- Click Settings (in the repository menu)
- Scroll down to the Pages section in the left sidebar
- Click on Pages
2. Configure Source
Under “Build and deployment”:
- Source: Select “GitHub Actions”
- This will use the workflow in
.github/workflows/docs.yaml
That’s it! GitHub will automatically use the workflow.
3. Trigger the First Build
The documentation will be built and deployed automatically when you push to the main branch.
To trigger the first build:
-
Push any change to
main:git push origin main -
Or manually trigger the workflow:
- Go to Actions tab
- Click on “Documentation” workflow
- Click “Run workflow”
- Select
mainbranch - Click “Run workflow”
4. Monitor the Build
- Go to the Actions tab in your repository
- Click on the “Documentation” workflow run
- Watch the build progress
- Once complete, the “deploy” job will show the URL
5. Access Your Documentation
Once deployed, your documentation will be available at:
https://firestoned.github.io/bindy/
Verification
Check Deployment Status
- Go to Settings → Pages
- You should see: “Your site is live at https://firestoned.github.io/bindy/”
- Click “Visit site” to view the documentation
Verify Documentation Structure
Your deployed site should have:
- Main documentation (mdBook): https://firestoned.github.io/bindy/
- API reference (rustdoc): https://firestoned.github.io/bindy/rustdoc/
Troubleshooting
Build Fails
Check workflow logs:
- Go to Actions tab
- Click on the failed workflow run
- Expand the failed step to see the error
- Common issues:
- Rust compilation errors
- mdBook build errors
- Missing files
Fix and retry:
- Fix the issue locally
- Test with
make docs - Push the fix to
main - GitHub Actions will automatically retry
Pages Not Showing
Verify GitHub Pages is enabled:
- Go to Settings → Pages
- Ensure source is set to “GitHub Actions”
- Check that at least one successful deployment has completed
Check permissions:
The workflow needs these permissions (already configured in docs.yaml):
permissions:
contents: read
pages: write
id-token: write
404 Errors on Subpages
Check base URL configuration:
The book.toml has:
site-url = "/bindy/"
This must match your repository name. If your repository is named differently, update this value.
Custom Domain (Optional)
To use a custom domain:
- Go to Settings → Pages
- Under “Custom domain”, enter your domain
- Update the
CNAMEfield inbook.toml:cname = "docs.yourdomain.com" - Configure DNS:
- Add a CNAME record pointing to
firestoned.github.io - Or A records pointing to GitHub Pages IPs
- Add a CNAME record pointing to
Updating Documentation
Documentation is automatically deployed on every push to main:
# Make changes to documentation
vim docs/src/introduction.md
# Commit and push
git add docs/src/introduction.md
git commit -m "Update introduction"
git push origin main
# GitHub Actions will automatically build and deploy
Local Preview
Before pushing, preview your changes locally:
# Build and serve documentation
make docs-serve
# Or watch for changes
make docs-watch
# Open http://localhost:3000 in your browser
Workflow Details
The GitHub Actions workflow (.github/workflows/docs.yaml):
-
Build job:
- Checks out the repository
- Sets up Rust toolchain
- Installs mdBook
- Builds rustdoc API documentation
- Builds mdBook user documentation
- Combines both into a single site
- Uploads artifact to GitHub Pages
-
Deploy job (only on
main):- Deploys the artifact to GitHub Pages
- Updates the live site
Branch Protection (Recommended)
To ensure documentation quality:
- Go to Settings → Branches
- Add a branch protection rule for
main:- Require pull request reviews
- Require status checks (include “Documentation / Build Documentation”)
- This ensures the documentation builds before merging
Additional Configuration
Custom Theme
The documentation uses a custom theme defined in:
docs/theme/custom.css- Custom styling
To customize:
- Edit the CSS file
- Test locally with
make docs-watch - Push to
main
Search Configuration
Search is configured in book.toml:
[output.html.search]
enable = true
limit-results = 30
Adjust as needed for your use case.
Support
For issues with GitHub Pages deployment:
- GitHub Pages Status: https://www.githubstatus.com/
- GitHub Actions Documentation: https://docs.github.com/en/actions
- GitHub Pages Documentation: https://docs.github.com/en/pages
For issues with the documentation content:
- Create an issue: https://github.com/firestoned/bindy/issues
- Start a discussion: https://github.com/firestoned/bindy/discussions