File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -27,12 +27,32 @@ jobs:
2727 ruby-version : ' 3.1'
2828 bundler-cache : true
2929
30+ - name : Setup staging for preview
31+ if : github.event.action != 'closed'
32+ run : |
33+ # Copy any new or modified post files to staging directory
34+ # This allows preview of posts before they go live
35+ mkdir -p staging
36+
37+ # Find modified .md files in _posts directory from this PR
38+ git diff --name-only origin/main...HEAD | grep "^_posts/.*\.md$" | while read file; do
39+ if [ -f "$file" ]; then
40+ echo "Staging post: $file"
41+ cp "$file" "staging/$(basename "$file")"
42+ fi
43+ done
44+
45+ # List staged files for debugging
46+ echo "Staged posts:"
47+ ls -la staging/ || echo "No posts staged"
48+
3049 - name : Build Jekyll site
3150 if : github.event.action != 'closed'
3251 run : |
3352 # Remove CNAME file for previews to avoid routing conflicts
3453 rm -f CNAME
35- bundle exec jekyll build
54+ # Build with preview config that includes staging posts
55+ bundle exec jekyll build --config _config.yml,_config_preview.yml
3656 env :
3757 JEKYLL_ENV : production
3858
Original file line number Diff line number Diff line change 1+ # Preview-specific configuration
2+ # This extends the main _config.yml for preview builds
3+
4+ # Collections for staging posts
5+ collections :
6+ staging :
7+ output : true
8+ permalink : /:collection/:name/
9+
10+ # Make staging posts appear in site.posts
11+ defaults :
12+ - scope :
13+ path : " staging"
14+ type : " staging"
15+ values :
16+ layout : " post"
17+
18+ # Include staging directory in the build
19+ include :
20+ - staging
Original file line number Diff line number Diff line change 1+ # Staging Directory
2+
3+ This directory contains markdown post files that are being staged for preview before publication.
4+
5+ ## Structure:
6+ - ` staging/ ` - Contains draft/preview post files
7+ - ` _posts/ ` - Contains published post files
8+
9+ ## Workflow:
10+ 1 . During preview builds, new post ` .md ` files are copied here
11+ 2 . Jekyll builds the site with both ` _posts/ ` and ` staging/ ` content
12+ 3 . After review and approval, posts are moved from ` staging/ ` to ` _posts/ `
13+ 4 . Staging directory is cleaned up after merge
You can’t perform that action at this time.
0 commit comments