Skip to content

Commit bdd945d

Browse files
committed
Add verbose logging and error handling to staging workflow
1 parent 33a3157 commit bdd945d

1 file changed

Lines changed: 35 additions & 4 deletions

File tree

.github/workflows/preview.yml

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,24 +76,55 @@ jobs:
7676
# Remove CNAME file for previews to avoid routing conflicts
7777
rm -f CNAME
7878
79+
# Show current directory structure before build
80+
echo "Files before build:"
81+
ls -la
82+
7983
# Build Jekyll site - staging posts will be included as a collection
80-
bundle exec jekyll build --config _config.yml,_config_preview.yml
84+
echo "Running Jekyll build..."
85+
bundle exec jekyll build --config _config.yml,_config_preview.yml --verbose
8186
82-
echo "Build completed. Site structure:"
83-
find _site -name "*.html" | head -10
87+
# Check if build succeeded
88+
if [ $? -eq 0 ]; then
89+
echo "Jekyll build completed successfully"
90+
else
91+
echo "Jekyll build failed!"
92+
exit 1
93+
fi
94+
95+
# Show what was built
96+
echo "Build completed. Checking _site directory:"
97+
if [ -d "_site" ]; then
98+
echo "_site directory exists"
99+
echo "Site structure:"
100+
find _site -name "*.html" | head -10
101+
echo "Total files in _site:"
102+
find _site -type f | wc -l
103+
else
104+
echo "ERROR: _site directory was not created!"
105+
exit 1
106+
fi
84107
env:
85108
JEKYLL_ENV: production
86109

87110
- name: Deploy staging site
88111
run: |
89112
echo "=== Deploying staging site ==="
90113
114+
# Verify _site directory exists before proceeding
115+
if [ ! -d "_site" ]; then
116+
echo "ERROR: _site directory not found. Build must have failed."
117+
exit 1
118+
fi
119+
120+
echo "_site directory found, proceeding with deployment..."
121+
91122
# Switch to gh-pages branch
92123
git fetch origin gh-pages:gh-pages || git checkout --orphan gh-pages
93124
git checkout gh-pages
94125
95126
# Clear all content and deploy full site to root
96-
rm -rf *
127+
rm -rf * 2>/dev/null || true
97128
rm -rf .*/ 2>/dev/null || true
98129
99130
# Copy built site to root of gh-pages

0 commit comments

Comments
 (0)