-
Notifications
You must be signed in to change notification settings - Fork 0
109 lines (92 loc) · 3.7 KB
/
deploy.yml
File metadata and controls
109 lines (92 loc) · 3.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
name: Deploy React Portfolio
on:
push:
branches: [ main ]
paths:
- 'front/**'
workflow_dispatch:
permissions:
contents: write
jobs:
build-and-deploy:
runs-on: ubuntu-latest
environment: github-pages
defaults:
run:
working-directory: ./front
steps:
- name: Checkout Repository 🛎️
uses: actions/checkout@v6
- name: Setup Node.js Environment ⚙️
uses: actions/setup-node@v6
with:
node-version: 18
cache: 'npm'
cache-dependency-path: 'front/package-lock.json'
- name: Setup Python 🐍
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install Dependencies 📦
run: npm ci
- name: Validate Content Consistency ✅
run: npm run sync:check
- name: Optimize Images 🖼️
run: |
echo "=== Checking for unoptimized images ==="
# Only optimize if there are new images (no .webp versions)
NEW_IMAGES=$(find public/images -type f \( -name "*.jpg" -o -name "*.jpeg" -o -name "*.png" \) ! -name "*-original.*" ! -name "*-optimized.*" | wc -l)
echo "Found $NEW_IMAGES images to potentially optimize"
if [ $NEW_IMAGES -gt 0 ]; then
# Check if webp versions already exist
WEBP_COUNT=$(find public/images -type f -name "*.webp" | wc -l)
echo "Existing WebP images: $WEBP_COUNT"
if [ $WEBP_COUNT -lt $NEW_IMAGES ]; then
echo "🔄 Optimizing images..."
npm run optimize-images || echo "⚠️ Optimization completed with warnings"
echo "✅ Image optimization complete"
else
echo "✅ Images already optimized, skipping"
fi
else
echo "✅ No new images to optimize"
fi
- name: Verify Blog Source Files 🔍
run: |
echo "=== Blog Source Directory Structure ==="
ls -la public/blog/ || echo "Blog directory not found"
echo "=== Available Markdown Posts ==="
find public/blog/posts -name "*.md" 2>/dev/null | wc -l | xargs echo "Found markdown files:"
find public/blog/posts -name "*.md" 2>/dev/null || echo "No markdown files found"
- name: Build Application 🔧
run: npm run build
env:
CI: false
AUDIO_BASE_URL_EN: https://pub-00d57ee081654fe389ef2660b8f38f69.r2.dev/audio
AUDIO_BASE_URL_ES: https://pub-00d57ee081654fe389ef2660b8f38f69.r2.dev/audio-es
- name: Verify Blog Data Generation 📊
run: |
echo "=== Generated Blog Data ==="
if [ -f "src/data/blogData.json" ]; then
echo "✅ blogData.json generated successfully"
echo "Posts count: $(cat src/data/blogData.json | grep -o '"slug"' | wc -l)"
echo "Categories: $(cat src/data/blogData.json | grep -o '"category":"[^"]*"' | sort -u)"
else
echo "❌ blogData.json not found"
exit 1
fi
- name: Verify Build Output 🔍
run: |
echo "=== Build Directory Structure ==="
ls -la build/
echo "=== Build Assets ==="
echo "JS files: $(find build/static/js -name "*.js" | wc -l)"
echo "CSS files: $(find build/static/css -name "*.css" | wc -l)"
echo "Total build size: $(du -sh build/ | cut -f1)"
- name: Deploy to GitHub Pages 🚀
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: front/build
branch: gh-pages
clean: true
commit-message: 'Deploy portfolio with blog data 🚀'