Skip to content

Commit fbc3d9d

Browse files
authored
Merge pull request #37 from digidem/feat/separate-content-branch
feat: separate content into dedicated branch
2 parents 9f155dc + 62979cb commit fbc3d9d

File tree

12 files changed

+758
-64
lines changed

12 files changed

+758
-64
lines changed

.github/workflows/clean-content.yml

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,29 @@ on:
1212
- 'no'
1313
- 'yes'
1414

15+
# Prevent concurrent content updates to avoid conflicts
16+
concurrency:
17+
group: "content-branch-updates"
18+
cancel-in-progress: false
19+
1520
jobs:
1621
clean-generated:
1722
runs-on: ubuntu-latest
18-
23+
1924
steps:
20-
- name: Checkout repository
25+
- name: Checkout content branch
2126
uses: actions/checkout@v4
22-
27+
with:
28+
ref: content
29+
2330
- name: Setup Bun
2431
uses: oven-sh/setup-bun@v2
2532
with:
2633
bun-version: latest
27-
34+
2835
- name: Install dependencies
2936
run: bun install
30-
37+
3138
- name: Validate confirmation
3239
run: |
3340
if [ "${{ github.event.inputs.confirm }}" != "yes" ]; then
@@ -36,10 +43,10 @@ jobs:
3643
exit 1
3744
fi
3845
echo "✅ Confirmation received. Proceeding with cleanup..."
39-
46+
4047
- name: Clean generated content
4148
run: bun run clean:generated --confirm=yes
42-
49+
4350
- name: Commit cleanup results
4451
run: |
4552
git config user.name "github-actions[bot]"
@@ -51,15 +58,15 @@ jobs:
5158
# Commit if there are changes
5259
git diff --cached --quiet || git commit -m "(content-cleanup): remove all generated content from Notion"
5360
54-
# Push back to the repository
55-
git push
61+
# Push to content branch
62+
git push origin content
5663
5764
env:
5865
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59-
66+
6067
- name: Show cleanup results
6168
run: |
6269
echo "🧹 Generated content cleanup completed"
6370
echo "📁 Remaining structure:"
6471
ls -la docs/ || echo "No docs directory"
65-
ls -la i18n/*/docusaurus-plugin-content-docs/current/ || echo "No i18n content directories"
72+
ls -la i18n/*/docusaurus-plugin-content-docs/current/ || echo "No i18n content directories"

.github/workflows/deploy-production.yml

Lines changed: 46 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,35 +15,72 @@ jobs:
1515
deploy:
1616
name: Deploy to Cloudflare Pages and Update Notion
1717
runs-on: ubuntu-latest
18-
18+
1919
steps:
20-
- name: Checkout code
20+
- name: Checkout code (main branch)
2121
uses: actions/checkout@v4
22-
22+
with:
23+
ref: main
24+
25+
- name: Checkout content files from content branch
26+
run: |
27+
set -e # Exit on error
28+
29+
echo "📥 Fetching content from content branch..."
30+
git fetch origin content
31+
32+
echo "📂 Checking out content files..."
33+
git checkout origin/content -- docs/ i18n/ static/images/
34+
35+
# Validate content exists
36+
echo "🔍 Validating content..."
37+
38+
if [ ! -d "docs" ] || [ -z "$(ls -A docs 2>/dev/null)" ]; then
39+
echo "❌ Error: docs/ directory is empty or missing"
40+
echo "Cannot proceed with build - documentation content is required"
41+
exit 1
42+
fi
43+
44+
if [ ! -d "i18n" ] || [ -z "$(ls -A i18n 2>/dev/null)" ]; then
45+
echo "⚠️ Warning: i18n/ directory is empty or missing"
46+
echo "Build will proceed but translations may be unavailable"
47+
fi
48+
49+
if [ ! -d "static/images" ] || [ -z "$(ls -A static/images 2>/dev/null)" ]; then
50+
echo "⚠️ Warning: static/images/ directory is empty or missing"
51+
echo "Build will proceed but images may be unavailable"
52+
fi
53+
54+
echo "✅ Content validation successful"
55+
echo "📊 Content statistics:"
56+
find docs -name "*.md" -type f 2>/dev/null | wc -l | xargs echo " - English docs:"
57+
find i18n -name "*.md" -type f 2>/dev/null | wc -l | xargs echo " - Localized docs:"
58+
find static/images -type f 2>/dev/null | wc -l | xargs echo " - Images:"
59+
2360
- name: Setup Bun
2461
uses: oven-sh/setup-bun@v2
2562
with:
2663
bun-version: latest
27-
64+
2865
- name: Install dependencies
2966
run: bun install
30-
67+
3168
- name: Build documentation
3269
run: bun run build
33-
70+
3471
- name: Deploy to Cloudflare Pages
3572
uses: cloudflare/wrangler-action@v3
3673
with:
3774
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
3875
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
3976
command: pages deploy build --project-name comapeo-docs --compatibility-date 2024-01-01
40-
77+
4178
- name: Update Notion status to Published
4279
run: bun run notionStatus:publish-production
4380
env:
4481
NOTION_API_KEY: ${{ secrets.NOTION_API_KEY }}
4582
DATABASE_ID: ${{ secrets.DATABASE_ID }}
46-
83+
4784
- name: Deployment summary
4885
run: |
4986
echo "🚀 **Production Deployment Complete!**" >> $GITHUB_STEP_SUMMARY
@@ -53,4 +90,4 @@ jobs:
5390
echo "- ✅ Notion status updated: Staging → Published" >> $GITHUB_STEP_SUMMARY
5491
echo "- 📅 Published date set to $(date -u +%Y-%m-%d)" >> $GITHUB_STEP_SUMMARY
5592
echo "" >> $GITHUB_STEP_SUMMARY
56-
echo "🌐 Site available at: https://docs.comapeo.app" >> $GITHUB_STEP_SUMMARY
93+
echo "🌐 Site available at: https://docs.comapeo.app" >> $GITHUB_STEP_SUMMARY

.github/workflows/deploy-staging.yml

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,46 @@ jobs:
3333
if: ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }}
3434
runs-on: ubuntu-latest
3535
steps:
36-
- name: Checkout
36+
- name: Checkout code (main branch)
3737
uses: actions/checkout@v5
3838
with:
3939
ref: main
4040

41+
- name: Checkout content files from content branch
42+
run: |
43+
set -e # Exit on error
44+
45+
echo "📥 Fetching content from content branch..."
46+
git fetch origin content
47+
48+
echo "📂 Checking out content files..."
49+
git checkout origin/content -- docs/ i18n/ static/images/
50+
51+
# Validate content exists
52+
echo "🔍 Validating content..."
53+
54+
if [ ! -d "docs" ] || [ -z "$(ls -A docs 2>/dev/null)" ]; then
55+
echo "❌ Error: docs/ directory is empty or missing"
56+
echo "Cannot proceed with build - documentation content is required"
57+
exit 1
58+
fi
59+
60+
if [ ! -d "i18n" ] || [ -z "$(ls -A i18n 2>/dev/null)" ]; then
61+
echo "⚠️ Warning: i18n/ directory is empty or missing"
62+
echo "Build will proceed but translations may be unavailable"
63+
fi
64+
65+
if [ ! -d "static/images" ] || [ -z "$(ls -A static/images 2>/dev/null)" ]; then
66+
echo "⚠️ Warning: static/images/ directory is empty or missing"
67+
echo "Build will proceed but images may be unavailable"
68+
fi
69+
70+
echo "✅ Content validation successful"
71+
echo "📊 Content statistics:"
72+
find docs -name "*.md" -type f 2>/dev/null | wc -l | xargs echo " - English docs:"
73+
find i18n -name "*.md" -type f 2>/dev/null | wc -l | xargs echo " - Localized docs:"
74+
find static/images -type f 2>/dev/null | wc -l | xargs echo " - Images:"
75+
4176
- name: Setup Bun
4277
uses: oven-sh/setup-bun@735343b667d3e6f658f44d0eca948eb6282f2b76 # v2.0.2
4378

.github/workflows/notion-fetch-test.yml

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,38 +9,45 @@ on:
99
default: true
1010
type: boolean
1111

12+
# Prevent concurrent content updates to avoid conflicts
13+
concurrency:
14+
group: "content-branch-updates"
15+
cancel-in-progress: false
16+
1217
jobs:
1318
fetch-notion:
1419
runs-on: ubuntu-latest
15-
20+
1621
environment: production
17-
22+
1823
steps:
19-
- name: Checkout repository
24+
- name: Checkout content branch
2025
uses: actions/checkout@v4
21-
26+
with:
27+
ref: content
28+
2229
- name: Setup Bun
2330
uses: oven-sh/setup-bun@v2
2431
with:
2532
bun-version: latest
26-
33+
2734
- name: Install dependencies
2835
run: bun install
29-
36+
3037
- name: Setup environment
3138
run: |
3239
if [ "${{ github.event.inputs.force }}" = "true" ]; then
3340
echo "🔄 Force mode enabled - will overwrite existing content"
3441
else
3542
echo "📥 Normal mode - will fetch and update content"
3643
fi
37-
44+
3845
- name: Fetch content from Notion
3946
env:
4047
NOTION_API_KEY: ${{ secrets.NOTION_API_KEY }}
4148
NOTION_DATABASE_ID: ${{ secrets.DATABASE_ID }}
4249
run: bun run notion:fetch-all
43-
50+
4451
- name: Commit fetched content
4552
run: |
4653
git config user.name "github-actions[bot]"
@@ -62,20 +69,20 @@ jobs:
6269
# Push back to the repository with retry logic
6370
max_attempts=10
6471
attempt=1
65-
72+
6673
while [ $attempt -le $max_attempts ]; do
6774
echo "🔄 Push attempt $attempt of $max_attempts"
68-
75+
6976
# Pull latest changes to avoid conflicts
70-
git pull origin main --rebase
71-
72-
# Try to push
73-
if git push; then
77+
git pull origin content --rebase
78+
79+
# Try to push to content branch
80+
if git push origin content; then
7481
echo "✅ Push successful on attempt $attempt"
7582
break
7683
else
7784
echo "❌ Push failed on attempt $attempt"
78-
85+
7986
if [ $attempt -eq $max_attempts ]; then
8087
echo "💥 Max attempts reached. Push failed after $max_attempts attempts."
8188
exit 1
@@ -89,7 +96,7 @@ jobs:
8996
9097
env:
9198
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
92-
99+
93100
- name: Show fetch results
94101
run: |
95102
echo "📊 Notion fetch completed"
@@ -98,7 +105,7 @@ jobs:
98105
find i18n -name "*.md" -type f | wc -l | xargs echo "Localized docs:"
99106
echo "🖼️ Generated images:"
100107
find static/images -name "*.jpg" -o -name "*.png" -o -name "*.gif" 2>/dev/null | wc -l | xargs echo "Images processed:"
101-
108+
102109
- name: Create summary
103110
run: |
104111
echo "## 📋 Notion Fetch Summary" >> $GITHUB_STEP_SUMMARY
@@ -114,4 +121,4 @@ jobs:
114121
echo "### 🎯 Next Steps" >> $GITHUB_STEP_SUMMARY
115122
echo "- Review generated content for quality" >> $GITHUB_STEP_SUMMARY
116123
echo "- Test site build: \`bun run build\`" >> $GITHUB_STEP_SUMMARY
117-
echo "- Deploy when ready" >> $GITHUB_STEP_SUMMARY
124+
echo "- Deploy when ready" >> $GITHUB_STEP_SUMMARY

.github/workflows/sync-docs.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,20 @@ on:
55
repository_dispatch:
66
types:
77
- sync-docs
8+
9+
# Prevent concurrent content updates to avoid conflicts
10+
concurrency:
11+
group: "content-branch-updates"
12+
cancel-in-progress: false
13+
814
jobs:
915
pull-docs:
1016
runs-on: ubuntu-latest
1117
steps:
12-
- name: Checkout
18+
- name: Checkout content branch
1319
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
20+
with:
21+
ref: content
1422

1523
- name: Setup Bun
1624
uses: oven-sh/setup-bun@735343b667d3e6f658f44d0eca948eb6282f2b76 # v2.0.2
@@ -42,8 +50,8 @@ jobs:
4250
# Commit if there are changes
4351
git diff --cached --quiet || git commit -m "(content-update): update docs from Notion"
4452
45-
# Push back to the repository
46-
git push
53+
# Push to content branch
54+
git push origin content
4755
4856
env:
4957
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/translate-docs.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,19 @@ on:
66
types:
77
- translate-docs
88

9+
# Prevent concurrent content updates to avoid conflicts
10+
concurrency:
11+
group: "content-branch-updates"
12+
cancel-in-progress: false
13+
914
jobs:
1015
translate-docs:
1116
runs-on: ubuntu-latest
1217
steps:
13-
- name: Checkout
18+
- name: Checkout content branch
1419
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
20+
with:
21+
ref: content
1522

1623
- name: Setup Bun
1724
uses: oven-sh/setup-bun@735343b667d3e6f658f44d0eca948eb6282f2b76 # v2.0.2
@@ -47,8 +54,8 @@ jobs:
4754
# Commit if there are changes
4855
git diff --cached --quiet || git commit -m "(translations-update): update with auto-translations"
4956
50-
# Push back to the repository
51-
git push
57+
# Push to content branch
58+
git push origin content
5259
5360
env:
5461
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,15 @@ favicon.ico
5252
favicon.svg
5353
/assets/
5454

55+
# Generated content (synced from content branch)
56+
# These directories are populated by checking out from the content branch
57+
/docs/
58+
/i18n/
59+
/static/images/
60+
61+
# Keep .gitkeep files for directory structure
62+
!.gitkeep
63+
5564
# Notion emoji files (keep .emoji-cache.json but ignore actual emoji images)
5665
static/images/emojis/*.png
5766
static/images/emojis/*.jpg

0 commit comments

Comments
 (0)