Skip to content

Commit a240947

Browse files
committed
Initial commit
0 parents  commit a240947

15 files changed

Lines changed: 1904 additions & 0 deletions

.github/workflows/deploy.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: Deploy MkDocs to GitHub Pages
2+
3+
on:
4+
push:
5+
branches:
6+
- site
7+
repository_dispatch:
8+
types: [modules-updated]
9+
workflow_dispatch:
10+
11+
permissions:
12+
contents: read
13+
pages: write
14+
id-token: write
15+
16+
concurrency:
17+
group: "pages"
18+
cancel-in-progress: false
19+
20+
jobs:
21+
build:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Checkout site branch
25+
uses: actions/checkout@v4
26+
27+
- name: Checkout master branch content
28+
uses: actions/checkout@v4
29+
with:
30+
ref: master
31+
path: master-content
32+
33+
- name: Copy module content from master
34+
run: |
35+
# Copy README.md as index page
36+
cp master-content/README.md docs/index.md
37+
echo "Copied README.md -> docs/index.md"
38+
39+
# Copy each module directory from master to docs/
40+
for dir in master-content/mod-*/; do
41+
module=$(basename "$dir")
42+
rm -rf "docs/${module}"
43+
cp -r "$dir" "docs/"
44+
echo "Copied ${module}/"
45+
done
46+
# Clean up
47+
rm -rf master-content
48+
echo "=== Module files in docs/ ==="
49+
ls -la docs/mod-* | head -30
50+
51+
- name: Setup Python
52+
uses: actions/setup-python@v5
53+
with:
54+
python-version: '3.12'
55+
56+
- name: Install dependencies
57+
run: pip install -r requirements.txt
58+
59+
- name: Update navigation from H1 titles
60+
run: python scripts/update_nav.py
61+
62+
- name: Build site
63+
run: mkdocs build
64+
65+
- name: Upload artifact
66+
uses: actions/upload-pages-artifact@v3
67+
with:
68+
path: ./site
69+
70+
deploy:
71+
environment:
72+
name: github-pages
73+
url: ${{ steps.deployment.outputs.page_url }}
74+
runs-on: ubuntu-latest
75+
needs: build
76+
steps:
77+
- name: Deploy to GitHub Pages
78+
id: deployment
79+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Build artifacts
2+
site/
3+
4+
# Content fetched from master during build
5+
docs/mod-*/
6+
docs/index.md
7+
8+
# Python virtual environment
9+
.venv/
10+
venv/
11+
env/
12+
13+
# Python cache
14+
__pycache__/
15+
*.py[cod]
16+
*$py.class
17+
18+
# IDE
19+
.vscode/
20+
.idea/
21+
22+
# OS
23+
.DS_Store
24+
Thumbs.db

README.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Modules - Site Branch
2+
3+
This branch contains the MkDocs build configuration for the MICRORACK Modules documentation.
4+
5+
**⚠️ Do not edit content here directly!** Edit the source markdown files in the `master` branch instead.
6+
7+
## How it works
8+
9+
1. Content is edited in the `master` branch (bare markdown files)
10+
2. GitHub Actions automatically syncs content to this branch
11+
3. MkDocs builds and deploys to GitHub Pages
12+
13+
## Branch Structure
14+
15+
### Master Branch (source - bare markdown)
16+
```
17+
repo/
18+
├── README.md # Index page content
19+
├── LICENSE.md # License file
20+
├── .github/
21+
│ └── workflows/
22+
│ └── sync-to-site.yml # Sync workflow
23+
├── mod-vco/
24+
│ ├── README.md
25+
│ └── mod-vco.png
26+
├── mod-vcf/
27+
│ ├── README.md
28+
│ └── mod-vcf.png
29+
└── ... (other modules)
30+
```
31+
32+
### Site Branch (this branch)
33+
```
34+
repo/
35+
├── README.md # This file
36+
├── mkdocs.yml # MkDocs configuration
37+
├── requirements.txt # Python dependencies
38+
├── scripts/
39+
│ └── convert_admonitions.py
40+
├── .github/
41+
│ └── workflows/
42+
│ └── deploy.yml # Deploy workflow
43+
└── docs/
44+
├── index.md # ← synced from master/README.md
45+
├── LICENSE.md # ← synced from master/LICENSE.md
46+
├── CNAME
47+
├── assets/ # CSS, JS, logos, fonts
48+
└── mod-*/ # ← synced from master/mod-*/
49+
```
50+
51+
## Local Development
52+
53+
```bash
54+
pip install -r requirements.txt
55+
mkdocs serve
56+
```
57+
58+
Visit http://127.0.0.1:8000
59+
60+
## GitHub Configuration
61+
62+
After creating the site branch:
63+
64+
1. **GitHub Pages Settings** (Settings → Pages):
65+
- Source: `GitHub Actions`
66+
67+
2. **Add site branch to allowed deployment branches**:
68+
```bash
69+
gh api repos/OWNER/REPO/environments/github-pages/deployment-branch-policies \
70+
--method POST -f name=site
71+
```
72+
73+
3. **Actions Permissions** (Settings → Actions → General):
74+
- Workflow permissions: Read and write permissions

docs/CNAME

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
modules.microrack.org

0 commit comments

Comments
 (0)