This guide will help you set up automatic synchronization between your main repository's docs/ directory and a separate altus4/docs repository.
The setup creates:
- Separate docs repository:
altus4/docsfor documentation only - Automatic sync: Changes in
docs/directory trigger sync to docs repo - GitHub Pages: Auto-deployment of documentation site with Mermaid diagram support
- Manual sync: Script for manual synchronization when needed
- GitHub Account with permissions to create repositories in the
altus4organization - Git configured with SSH keys or personal access token
- Repository access to both main and docs repositories
-
Create the repository on GitHub:
Repository name: altus4/docs Description: Documentation for Altus 4 - AI-Enhanced MySQL Full-Text Search Engine Visibility: Public (recommended for GitHub Pages) Initialize: Add a README file -
Enable GitHub Pages:
- Go to repository Settings → Pages
- Source: GitHub Actions
- This allows the workflow to deploy automatically
-
Generate a token:
- Go to GitHub Settings → Developer settings → Personal access tokens → Tokens (classic)
- Click Generate new token (classic)
- Name:
docs-sync-token - Expiration: No expiration (or set as needed)
- Scopes:
repo(Full control of private repositories)workflow(Update GitHub Action workflows)
-
Copy the token - you'll need it in the next step
In your main repository (this one):
- Go to Settings → Secrets and variables → Actions
- Click New repository secret
- Add the following secret:
- Name:
DOCS_SYNC_TOKEN - Value: The personal access token from Step 2
- Name:
-
Make a change to any file in the
docs/directory -
Commit and push to the
mainordevelopbranch:git add docs/ git commit -m "docs: test sync setup" git push origin main -
Check the Actions tab in your main repository to see the sync workflow running
-
Verify the docs repository receives the changes
-
Check GitHub Pages deployment (may take a few minutes)
# Sync docs with auto-generated commit message
npm run docs:sync
# Sync docs with custom commit message
npm run docs:sync:force# Basic sync
./scripts/sync-docs.sh
# Sync with custom message
./scripts/sync-docs.sh "docs: update API documentation"- Go to Actions tab in your main repository
- Select Sync Documentation workflow
- Click Run workflow
- Choose branch and optionally force sync
After setup, your repositories will look like:
├── docs/ # Source documentation
│ ├── .vitepress/
│ ├── api/
│ ├── architecture/
│ └── ...
├── scripts/
│ └── sync-docs.sh # Manual sync script
├── .github/workflows/
│ └── sync-docs.yml # Auto-sync workflow
└── package.json # Includes docs:sync scripts
├── .vitepress/ # VitePress config (synced)
├── api/ # API docs (synced)
├── architecture/ # Architecture docs (synced)
├── .github/workflows/
│ └── deploy.yml # GitHub Pages deployment
├── package.json # VitePress dependencies
├── README.md # Docs-specific README
└── .gitignore # Docs-specific gitignore
Edit scripts/sync-docs.sh to customize:
# Repository URLs
DOCS_REPO_URL="https://github.com/altus4/docs.git"
DOCS_REPO_SSH="git@github.com:altus4/docs.git"
# Directories
DOCS_DIR="docs"
TEMP_DIR="/tmp/altus4-docs-sync"Edit .github/workflows/sync-docs.yml to customize:
# Trigger branches
on:
push:
branches: [main, develop] # Add/remove branches as needed
paths:
- 'docs/**' # Only sync on docs changes
- 'README.md' # Also sync README changes-
Permission Denied
- Check that
DOCS_SYNC_TOKENsecret is set correctly - Verify token has
repoandworkflowpermissions - Ensure token hasn't expired
- Check that
-
Repository Not Found
- Verify
altus4/docsrepository exists - Check repository name in script matches exactly
- Ensure you have access to the docs repository
- Verify
-
Sync Script Fails
-
Run script manually to see detailed error messages:
./scripts/sync-docs.sh
-
Check git configuration and credentials
-
-
GitHub Pages Not Deploying
- Verify GitHub Pages is enabled in docs repository settings
- Check that Pages source is set to "GitHub Actions"
- Review the deploy workflow in the docs repository
# Test script without pushing
cd /tmp/altus4-docs-sync
git status
git diff
# Check GitHub Action logs
# Go to Actions tab → Sync Documentation → View logs
# Test manual sync with verbose output
bash -x scripts/sync-docs.shWhen everything is working correctly:
- Automatic Sync: Changes to
docs/trigger the sync workflow - Docs Repository: Updated within minutes of main repo changes
- GitHub Pages: Documentation site updates automatically
- Manual Sync:
npm run docs:syncworks without errors
After setup is complete:
- Bookmark the docs site:
https://altus4.github.io/docs - Update README: Add link to documentation site
- Team notification: Inform team about the new documentation workflow
- Monitor: Check sync status after first few documentation changes
- Documentation Site: https://altus4.github.io/docs
- Docs Repository: https://github.com/altus4/docs
- VitePress Documentation: https://vitepress.dev/
- GitHub Actions Documentation: https://docs.github.com/en/actions
Need help? Check the troubleshooting section above or create an issue in the main repository.