Skip to content

Commit e7b1cd3

Browse files
furicclaude
andcommitted
Add automated wiki documentation sync
Features: - GitHub Actions workflow to auto-sync wiki on push to docs/wiki/ - Manual sync script (scripts/sync-wiki.sh) - npm run sync-wiki command for convenience - Comprehensive documentation in scripts/README.md Workflow triggers: - Automatically on push to main branch when docs/wiki/ changes - Manually via workflow_dispatch - Via npm run sync-wiki for local testing File mapping: - docs/wiki/wiki-*.md → Wiki pages with proper naming - Preserves all wiki content and formatting 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 9e3ebaf commit e7b1cd3

4 files changed

Lines changed: 179 additions & 1 deletion

File tree

.github/workflows/sync-wiki.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Sync Wiki Documentation
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
paths:
7+
- 'docs/wiki/**'
8+
workflow_dispatch: # Allow manual trigger
9+
10+
jobs:
11+
sync-wiki:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout main repository
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
20+
- name: Checkout wiki repository
21+
uses: actions/checkout@v4
22+
with:
23+
repository: ${{ github.repository }}.wiki
24+
path: wiki
25+
26+
- name: Copy documentation files to wiki
27+
run: |
28+
echo "Syncing wiki documentation..."
29+
cp docs/wiki/wiki-home.md wiki/Home.md
30+
cp docs/wiki/wiki-installation-setup.md wiki/Installation-\&-Setup.md
31+
cp docs/wiki/wiki-component-reference.md wiki/Component-Reference.md
32+
cp docs/wiki/wiki-complete-examples.md wiki/Complete-Examples.md
33+
cp docs/wiki/wiki-troubleshooting.md wiki/Troubleshooting.md
34+
cp docs/wiki/wiki-architecture-overview.md wiki/Architecture-Overview.md
35+
echo "✅ Files copied successfully"
36+
37+
- name: Check for changes
38+
id: check_changes
39+
run: |
40+
cd wiki
41+
if [ -n "$(git status --porcelain)" ]; then
42+
echo "changes=true" >> $GITHUB_OUTPUT
43+
echo "📝 Changes detected in wiki files"
44+
else
45+
echo "changes=false" >> $GITHUB_OUTPUT
46+
echo "✅ No changes to sync"
47+
fi
48+
49+
- name: Commit and push wiki changes
50+
if: steps.check_changes.outputs.changes == 'true'
51+
run: |
52+
cd wiki
53+
git config user.name "github-actions[bot]"
54+
git config user.email "github-actions[bot]@users.noreply.github.com"
55+
git add .
56+
git commit -m "Auto-sync wiki documentation from main repo
57+
58+
Synced from commit: ${{ github.sha }}
59+
Triggered by: ${{ github.event_name }}
60+
61+
🤖 Automated sync via GitHub Actions"
62+
git push
63+
64+
- name: Summary
65+
if: steps.check_changes.outputs.changes == 'true'
66+
run: |
67+
echo "✅ Wiki documentation synced successfully!"
68+
echo "📚 View at: https://github.com/${{ github.repository }}/wiki"

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@
4848
"dev": "npm run build:watch",
4949
"demo": "npm run build && open demo.html",
5050
"clean": "rm -rf dist",
51-
"prepublishOnly": "npm run clean && npm run build"
51+
"prepublishOnly": "npm run clean && npm run build",
52+
"sync-wiki": "./scripts/sync-wiki.sh"
5253
},
5354
"devDependencies": {
5455
"@rollup/plugin-commonjs": "^25.0.0",

scripts/README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Scripts
2+
3+
Utility scripts for Cosmic UI Lite development and maintenance.
4+
5+
## sync-wiki.sh
6+
7+
Manually sync documentation from `docs/wiki/` to the GitHub wiki repository.
8+
9+
### Usage
10+
11+
```bash
12+
# Via npm script (recommended)
13+
npm run sync-wiki
14+
15+
# Or directly
16+
./scripts/sync-wiki.sh
17+
```
18+
19+
### What it does
20+
21+
1. Clones or updates the wiki repository (`cosmic-ui-lite.wiki`)
22+
2. Copies all documentation files from `docs/wiki/` to the wiki repo
23+
3. Commits and pushes changes to GitHub
24+
25+
### File Mapping
26+
27+
| Source File | Wiki Page |
28+
|-------------|-----------|
29+
| `wiki-home.md` | `Home.md` |
30+
| `wiki-installation-setup.md` | `Installation-&-Setup.md` |
31+
| `wiki-component-reference.md` | `Component-Reference.md` |
32+
| `wiki-complete-examples.md` | `Complete-Examples.md` |
33+
| `wiki-troubleshooting.md` | `Troubleshooting.md` |
34+
| `wiki-architecture-overview.md` | `Architecture-Overview.md` |
35+
36+
### Automatic Sync
37+
38+
Wiki documentation is automatically synced via GitHub Actions when:
39+
- Changes are pushed to `docs/wiki/` on the `main` branch
40+
- Workflow can also be triggered manually from GitHub Actions tab
41+
42+
See `.github/workflows/sync-wiki.yml` for the automation workflow.

scripts/sync-wiki.sh

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
#!/bin/bash
2+
# Script to manually sync wiki documentation
3+
# Usage: ./scripts/sync-wiki.sh
4+
5+
set -e # Exit on error
6+
7+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
8+
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
9+
WIKI_REPO="$PROJECT_ROOT/cosmic-ui-lite.wiki"
10+
11+
echo "🔄 Starting wiki sync..."
12+
13+
# Check if docs/wiki directory exists
14+
if [ ! -d "$PROJECT_ROOT/docs/wiki" ]; then
15+
echo "❌ Error: docs/wiki directory not found"
16+
exit 1
17+
fi
18+
19+
# Clone or update wiki repository
20+
if [ -d "$WIKI_REPO" ]; then
21+
echo "📦 Updating existing wiki repository..."
22+
cd "$WIKI_REPO"
23+
git pull origin master
24+
else
25+
echo "📦 Cloning wiki repository..."
26+
cd "$PROJECT_ROOT"
27+
git clone https://github.com/fuR-Gaming/cosmic-ui-lite.wiki.git
28+
fi
29+
30+
# Copy documentation files
31+
echo "📝 Copying documentation files..."
32+
cp "$PROJECT_ROOT/docs/wiki/wiki-home.md" "$WIKI_REPO/Home.md"
33+
cp "$PROJECT_ROOT/docs/wiki/wiki-installation-setup.md" "$WIKI_REPO/Installation-&-Setup.md"
34+
cp "$PROJECT_ROOT/docs/wiki/wiki-component-reference.md" "$WIKI_REPO/Component-Reference.md"
35+
cp "$PROJECT_ROOT/docs/wiki/wiki-complete-examples.md" "$WIKI_REPO/Complete-Examples.md"
36+
cp "$PROJECT_ROOT/docs/wiki/wiki-troubleshooting.md" "$WIKI_REPO/Troubleshooting.md"
37+
cp "$PROJECT_ROOT/docs/wiki/wiki-architecture-overview.md" "$WIKI_REPO/Architecture-Overview.md"
38+
39+
# Check for changes
40+
cd "$WIKI_REPO"
41+
if [ -z "$(git status --porcelain)" ]; then
42+
echo "✅ No changes to sync"
43+
exit 0
44+
fi
45+
46+
# Show changes
47+
echo "📊 Changes detected:"
48+
git status --short
49+
50+
# Commit and push
51+
echo "💾 Committing changes..."
52+
git add .
53+
54+
# Get the latest commit message from main repo for context
55+
LATEST_COMMIT=$(cd "$PROJECT_ROOT" && git log -1 --pretty=format:"%s")
56+
57+
git commit -m "Sync wiki documentation
58+
59+
Latest main repo commit: $LATEST_COMMIT
60+
61+
🔄 Manual sync via script"
62+
63+
echo "🚀 Pushing to GitHub..."
64+
git push origin master
65+
66+
echo "✅ Wiki documentation synced successfully!"
67+
echo "📚 View at: https://github.com/fuR-Gaming/cosmic-ui-lite/wiki"

0 commit comments

Comments
 (0)