deploy-wiki.shā¢3.95 kB
#!/bin/bash
# Script to automatically deploy wiki content to GitHub
set -e
echo "š Deploying Wiki to GitHub..."
# Check if gh is installed
if ! command -v gh &> /dev/null; then
echo "ā GitHub CLI (gh) is required but not installed."
echo "Install with: brew install gh"
exit 1
fi
# Check if we're in the right directory
if [ ! -f "wiki-enhanced.md" ]; then
echo "ā wiki-enhanced.md not found. Are you in the right directory?"
exit 1
fi
# Clone the wiki repository
echo "š„ Cloning wiki repository..."
rm -rf .wiki-temp
git clone https://github.com/jamubc/gemini-mcp-tool.wiki.git .wiki-temp 2>/dev/null || {
echo "ā ļø Wiki doesn't exist yet. Creating it through GitHub..."
# Create initial wiki page through API
gh api repos/jamubc/gemini-mcp-tool/wiki/pages \
--method POST \
-f title="Home" \
-f body="Initializing wiki..." || true
# Try cloning again
git clone https://github.com/jamubc/gemini-mcp-tool.wiki.git .wiki-temp
}
cd .wiki-temp
# Function to extract section from wiki-enhanced.md
extract_section() {
local section_name="$1"
local output_file="$2"
local start_pattern="$3"
local end_pattern="$4"
awk "/$start_pattern/,/$end_pattern/" ../wiki-enhanced.md |
tail -n +2 |
head -n -1 > "$output_file"
}
echo "š Creating wiki pages..."
# Home page
awk '/^## Home Page \(Welcome\)/,/^---$/' ../wiki-enhanced.md | tail -n +2 | head -n -2 > Home.md
# Getting Started
awk '/^## Getting Started$/,/^---$/' ../wiki-enhanced.md | tail -n +2 | head -n -2 > Getting-Started.md
# User Guide
awk '/^## User Guide$/,/^---$/' ../wiki-enhanced.md | tail -n +2 | head -n -2 > User-Guide.md
# Examples
awk '/^## Examples$/,/^---$/' ../wiki-enhanced.md | tail -n +2 | head -n -2 > Examples.md
# Development
awk '/^## Development$/,/^---$/' ../wiki-enhanced.md | tail -n +2 | head -n -2 > Development.md
# API Reference
awk '/^## API Reference$/,/^---$/' ../wiki-enhanced.md | tail -n +2 | head -n -2 > API-Reference.md
# Troubleshooting
awk '/^## Troubleshooting$/,/^---$/' ../wiki-enhanced.md | tail -n +2 | head -n -2 > Troubleshooting.md
# Roadmap
awk '/^## Roadmap$/,/^---$/' ../wiki-enhanced.md | tail -n +2 | head -n -2 > Roadmap.md
# Community & Support
awk '/^## Community & Support$/,/^---$/' ../wiki-enhanced.md | tail -n +2 | head -n -2 > Community-&-Support.md
# Create sidebar for navigation
cat > _Sidebar.md << 'EOF'
## š Navigation
**Getting Started**
* [[Home]]
* [[Getting Started|Getting-Started]]
* [[User Guide|User-Guide]]
* [[Examples]]
**Reference**
* [[API Reference|API-Reference]]
* [[Troubleshooting]]
**Contributing**
* [[Development]]
* [[Roadmap]]
* [[Community & Support|Community-&-Support]]
---
**Quick Links**
* [š¦ NPM Package](https://www.npmjs.com/package/gemini-mcp-tool)
* [š GitHub Repo](https://github.com/jamubc/gemini-mcp-tool)
* [š Report Issue](https://github.com/jamubc/gemini-mcp-tool/issues/new)
EOF
# Create footer
cat > _Footer.md << 'EOF'
---
š [MIT License](https://github.com/jamubc/gemini-mcp-tool/blob/main/LICENSE) |
š§ [Contribute](https://github.com/jamubc/gemini-mcp-tool/blob/main/CONTRIBUTING.md) |
š¦ [NPM](https://www.npmjs.com/package/gemini-mcp-tool) |
ā [Star on GitHub](https://github.com/jamubc/gemini-mcp-tool)
EOF
# Commit and push
echo "š¾ Committing changes..."
git add -A
git commit -m "š Deploy comprehensive wiki documentation
- Added all major sections from wiki-enhanced.md
- Created navigation sidebar
- Added footer with quick links
- Structured content for easy navigation" || echo "No changes to commit"
echo "š¤ Pushing to GitHub..."
git push origin master || git push origin main
cd ..
rm -rf .wiki-temp
echo "ā
Wiki deployed successfully!"
echo "š View at: https://github.com/jamubc/gemini-mcp-tool/wiki"
echo ""
echo "š Note: It may take a few seconds for changes to appear on GitHub."