Spaces:
Configuration error
Configuration error
| name: CI/CD | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| quality-checks: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| - run: npm install | |
| - run: npm run validate | |
| build: | |
| needs: quality-checks | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| - run: npm install | |
| - run: npm run build | |
| - name: List contents of dist/images/optimized | |
| run: | | |
| ls -l dist/images/optimized || echo "No optimized images found" | |
| - uses: actions/upload-artifact@v3 | |
| with: | |
| name: dist | |
| path: dist | |
| deploy: | |
| needs: build | |
| if: github.ref == 'refs/heads/main' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/download-artifact@v3 | |
| with: | |
| name: dist | |
| path: dist | |
| - name: List contents of dist/images/optimized before deploy | |
| run: | | |
| ls -l dist/images/optimized || echo "No optimized images found" | |
| - uses: peaceiris/actions-gh-pages@v3 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ./dist | |
| publish_branch: gh-pages | |
| commit_message: "Deploy: ${{ github.event.head_commit.message }}" | |
| - name: Discord Notification | |
| if: success() | |
| uses: Ilshidur/action-discord@master | |
| with: | |
| args: "🚀 Déploiement réussi: ${{ github.repository }}" | |
| env: | |
| DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} | |
| sync: | |
| needs: deploy | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Sync files | |
| uses: repo-sync/github-sync@v2 | |
| with: | |
| source_repo: 'DavidKRK/DavidKRK.github.io' | |
| source_branch: 'main' | |
| destination_branch: 'gh-pages' | |
| file_patterns: 'images/optimized/*' | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |