@@ -32,100 +32,24 @@ jobs:
3232 echo "Published posts:"
3333 ls -1 _posts/*.md 2>/dev/null | head -5 || echo " (none)"
3434
35- - name : Build Jekyll site with staging
36- run : |
37- echo "=== Building Jekyll site with staging ==="
38-
39- # Show what files are available to Jekyll
40- echo "=== Available content ==="
41- echo "Posts in _posts/:"
42- ls -la _posts/ 2>/dev/null || echo "No _posts directory"
43-
44- echo "Posts in staging/:"
45- ls -la staging/ 2>/dev/null || echo "No staging directory"
46-
47- echo "Index files:"
48- ls -la *.html *.md 2>/dev/null || echo "No index files"
49-
50- # Show Jekyll configs
51- echo "=== Jekyll Configuration ==="
52- echo "Main config exists: $(test -f _config.yml && echo 'YES' || echo 'NO')"
53- echo "Preview config exists: $(test -f _config_preview.yml && echo 'YES' || echo 'NO')"
54-
55- # Remove CNAME file for previews to avoid routing conflicts
56- rm -f CNAME
57-
58- # Build Jekyll site with maximum verbosity
59- echo "=== Running Jekyll Build ==="
60- echo "First, try building with main config only..."
61-
62- set -e # Exit on any error
63-
64- bundle exec jekyll build --config _config.yml --verbose 2>&1 | tee build-main.log
65-
66- echo "Main config build result:"
67- if [ -d "_site" ] && [ -n "$(ls -A _site 2>/dev/null)" ]; then
68- echo "✅ Main config build SUCCESS - _site has content"
69- echo "Files created: $(find _site -type f | wc -l)"
70- echo "Sample files:"
71- find _site -name "*.html" | head -5
72-
73- echo "Now trying with preview config..."
74- rm -rf _site
75- bundle exec jekyll build --config _config.yml,_config_preview.yml --verbose 2>&1 | tee build-preview.log
76-
77- echo "Preview config build result:"
78- if [ -d "_site" ] && [ -n "$(ls -A _site 2>/dev/null)" ]; then
79- echo "✅ Preview config build SUCCESS"
80- echo "Files created: $(find _site -type f | wc -l)"
81- else
82- echo "❌ Preview config build FAILED or empty"
83- echo "Build log:"
84- cat build-preview.log
85- exit 1
86- fi
87- else
88- echo "❌ Main config build FAILED or empty"
89- echo "Build log:"
90- cat build-main.log
91- exit 1
92- fi
93-
94- # Check build results in detail
95- echo "=== Build Results ==="
96- if [ -d "_site" ]; then
97- echo "_site directory exists"
98- echo "Contents of _site/:"
99- find _site -type f -exec ls -la {} \; 2>/dev/null || echo "No files in _site"
100- echo "Total files: $(find _site -type f 2>/dev/null | wc -l)"
101- else
102- echo "ERROR: _site directory does not exist!"
103- exit 1
104- fi
35+ - name : Build with Jekyll
36+ run : bundle exec jekyll build
10537 env :
10638 JEKYLL_ENV : production
10739
108- - name : Deploy staging site
40+ - name : Deploy to gh-pages
10941 run : |
110- echo "=== Deploying staging site ==="
111-
112- # Switch to gh-pages branch
42+ # Switch to gh-pages branch
11343 git fetch origin gh-pages:gh-pages || git checkout --orphan gh-pages
11444 git checkout gh-pages
11545
116- # Clear all content and deploy full site to root
46+ # Clear and copy site
11747 rm -rf * 2>/dev/null || true
118- rm -rf .*/ 2>/dev/null || true
119-
120- # Copy built site to root of gh-pages
121- cp -r _site/* ./
48+ cp -r _site/* ./ 2>/dev/null || true
12249
123- # Commit and push the staging site
50+ # Commit and push
12451 git add -A
12552 git config user.name "GitHub Actions"
12653 git config user.email "actions@github.com"
127- git commit -m "Deploy staging preview from PR #${{ github.event.number }}" || exit 0
54+ git commit -m "Deploy preview from PR #${{ github.event.number }}" || exit 0
12855 git push origin gh-pages
129-
130- echo "=== Staging deployment complete ==="
131- echo "Preview URL: https://devnomadic.github.io/"
0 commit comments