Deep Wiki: Deploy to GitHub Pages
Generate a .github/workflows/deploy-wiki.yml GitHub Actions workflow that builds and deploys the VitePress wiki to GitHub Pages.
Step 1: Check Prerequisites
Before generating the workflow:
- Verify wiki exists: Check that
wiki/directory andwiki/package.jsonexist- If not, tell the user: "Run
/deep-wiki:buildfirst to scaffold the VitePress site."
- If not, tell the user: "Run
- Check for existing deployment workflows: Search for ANY existing GitHub Pages workflow:bash
# Check for exact file ls .github/workflows/deploy-wiki.yml 2>/dev/null # Check for any pages-related workflow grep -rl "deploy-pages\|pages-artifact\|github-pages" .github/workflows/ 2>/dev/null- If
deploy-wiki.ymlexists → STOP. Tell the user: "A deployment workflow already exists at.github/workflows/deploy-wiki.yml. No changes needed." - If a DIFFERENT pages workflow exists → ASK the user: "I found an existing GitHub Pages workflow at
\{path\}. Should I skip creating a new one, or createdeploy-wiki.ymlalongside it?" - If no pages workflow exists → proceed with generation
- If
Step 2: Generate Workflow File
Create .github/workflows/deploy-wiki.yml:
yaml
name: Deploy Wiki to GitHub Pages
on:
push:
branches: [main]
paths:
- 'wiki/**'
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: pages
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
cache-dependency-path: wiki/package-lock.json
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Install dependencies
run: npm ci
working-directory: wiki
- name: Build with VitePress
run: npm run build
working-directory: wiki
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: wiki/.vitepress/dist
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
needs: build
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4Workflow Details
| Setting | Value | Why |
|---|---|---|
| Trigger | Push to main on wiki/** paths | Only rebuilds when wiki content changes |
| Manual trigger | workflow_dispatch | Allows manual re-deployment |
| Node version | 20 | LTS, required for VitePress 1.x |
| Cache | npm with wiki/package-lock.json | Speeds up subsequent builds |
| Concurrency | pages group, no cancel | Prevents parallel deploys |
| Permissions | contents: read, pages: write, id-token: write | Minimum required for Pages deployment |
Step 3: Update VitePress Config for GitHub Pages
Check if wiki/.vitepress/config.mts needs a base path. GitHub Pages serves from:
- User/org site (
username.github.io):base: '/'(default, no change needed) - Project site (
username.github.io/repo-name):base: '/repo-name/'
Detect which case applies:
bash
# Get the repo name
REPO_NAME=$(basename $(git remote get-url origin) .git)
OWNER=$(git remote get-url origin | sed -E 's|.*[:/]([^/]+)/[^/]+\.git|\\1|')If the repo is NOT named \{owner\}.github.io, add the base path to config.mts:
typescript
export default defineConfig({
base: '/{repo-name}/',
// ... rest of config
})Step 4: Generate package-lock.json
If wiki/package-lock.json doesn't exist (required for npm ci in CI):
bash
cd wiki && npm installThis generates the lock file. Remind the user to commit it.
Step 5: Commit and Report
After generating the workflow, output:
## GitHub Pages Deployment Setup ✅
### Files Created
- `.github/workflows/deploy-wiki.yml` — GitHub Actions workflow
### Files Modified
- `wiki/.vitepress/config.mts` — Added `base: '/{repo-name}/'` (if project site)
### What You Need To Do
> ⚠️ IMPORTANT: GitHub Pages will NOT work until you complete step 2.
1. **Commit the workflow file:**
```bash
git add .github/workflows/deploy-wiki.yml wiki/package-lock.json
git commit -m "ci: add GitHub Pages deployment for wiki"
git pushEnable GitHub Pages (REQUIRED — deployments will fail without this):
- Go to your repo on GitHub → Settings → Pages
- Under Build and deployment, change Source to "GitHub Actions"
- Click Save
- Without this step, the workflow runs but the site is NOT published
Your wiki will be live at:
https://\{owner\}.github.io/\{repo-name\}/(project site)- OR
https://\{owner\}.github.io/(if repo is named\{owner\}.github.io)
Triggering Deployments
- Automatic: Every push to
mainthat changeswiki/**files - Manual: Go to Actions → "Deploy Wiki to GitHub Pages" → "Run workflow"
## Troubleshooting Guidance
If the user reports issues, suggest checking:
| Issue | Solution |
|-------|----------|
| 404 on deployed site | Verify `base` path in `config.mts` matches repo name |
| Build fails on `npm ci` | Ensure `wiki/package-lock.json` is committed |
| Pages not enabled | Go to Settings → Pages → Source → select "GitHub Actions" |
| Workflow not triggering | Check that changes are in `wiki/**` and pushed to `main` |
| Mermaid diagrams missing | Ensure `mermaid` and `vitepress-plugin-mermaid` are in `package.json` |
$ARGUMENTS