1- name : Build and Deploy
1+ name : CI/CD
22
33on :
44 push :
77 branches : [main]
88
99jobs :
10- quality :
10+ quality-checks :
1111 runs-on : ubuntu-latest
1212 steps :
1313 - uses : actions/checkout@v4
@@ -18,41 +18,31 @@ jobs:
1818 node-version : ' 20'
1919 cache : ' npm'
2020
21- - name : Install dependencies
22- run : npm install
23-
24- - name : Check HTML files
25- run : npm run validate:html
26-
27- - name : Check CSS files
28- run : npm run validate:css
21+ - run : npm install
22+ - run : npm run validate
2923
3024 build :
31- needs : quality
25+ needs : quality-checks
3226 runs-on : ubuntu-latest
3327 steps :
3428 - uses : actions/checkout@v4
3529
36- - name : Setup Node.js
37- uses : actions/setup-node@v4
30+ - uses : actions/setup-node@v4
3831 with :
3932 node-version : ' 20'
4033 cache : ' npm'
4134
42- - name : Install dependencies
43- run : npm install
44-
45- - name : Build project
46- run : npm run build
47-
48- - name : Upload build artifacts
49- uses : actions/upload-artifact@v3
35+ - run : npm install
36+ - run : npm run build
37+
38+ - name : List contents of dist/images/optimized
39+ run : |
40+ ls -l dist/images/optimized || echo "No optimized images found"
41+
42+ - uses : actions/upload-artifact@v3
5043 with :
5144 name : dist
52- path : |
53- dist/
54- !dist/node_modules/
55- !dist/package*.json
45+ path : dist
5646
5747 deploy :
5848 needs : build
@@ -61,23 +51,42 @@ jobs:
6151 steps :
6252 - uses : actions/checkout@v4
6353
64- - name : Download build artifacts
65- uses : actions/download-artifact@v3
54+ - uses : actions/download-artifact@v3
6655 with :
6756 name : dist
6857 path : dist
69-
70- - name : Deploy to GitHub Pages
71- uses : peaceiris/actions-gh-pages@v3
58+
59+ - name : List contents of dist/images/optimized before deploy
60+ run : |
61+ ls -l dist/images/optimized || echo "No optimized images found"
62+
63+ - uses : peaceiris/actions-gh-pages@v3
7264 with :
7365 github_token : ${{ secrets.GITHUB_TOKEN }}
7466 publish_dir : ./dist
7567 publish_branch : gh-pages
7668 commit_message : " Deploy: ${{ github.event.head_commit.message }}"
7769
78- - name : Notifier Discord
79- uses : Ilshidur/action-discord@v1.0.1 # Mettez à jour avec une version qui existe
80- with :
81- message : ' 🚀 Site déployé avec succès : ${{ github.repository }}'
70+ - name : Discord Notification
71+ if : success()
72+ uses : Ilshidur/action-discord@master
73+ with :
74+ args : " 🚀 Déploiement réussi: ${{ github.repository }}"
75+ env :
76+ DISCORD_WEBHOOK : ${{ secrets.DISCORD_WEBHOOK }}
77+
78+ sync :
79+ needs : deploy
80+ runs-on : ubuntu-latest
81+ steps :
82+ - uses : actions/checkout@v4
83+
84+ - name : Sync files
85+ uses : repo-sync/github-sync@v2
86+ with :
87+ source_repo : ' DavidKRK/DavidKRK.github.io'
88+ source_branch : ' main'
89+ destination_branch : ' gh-pages'
90+ file_patterns : ' images/optimized/*'
8291 env :
83- DISCORD_WEBHOOK : ${{ secrets.DISCORD_WEBHOOK }}
92+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments