<h2>CI/CD avec GitHub Actions</h2><h3>Fichier workflow</h3><pre><code># .github/workflows/deploy.yml\nname: Deploy\non:\n push:\n branches: [main]\njobs:\n deploy:\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4\n - name: Install dependencies\n run: composer install --no-dev\n - name: Run tests\n run: vendor/bin/phpunit\n - name: Deploy to server\n uses: appleboy/ssh-action@v1\n with:\n host: ${{ secrets.SERVER_HOST }}\n username: ${{ secrets.SERVER_USER }}\n key: ${{ secrets.SSH_KEY }}\n script: |\n cd /var/www/app\n git pull origin main\n composer install --no-dev\n php artisan migrate --force</code></pre><h3>Secrets GitHub</h3><p>Settings → Secrets → ajoutez SERVER_HOST, SERVER_USER, SSH_KEY.</p><h3>Résultat</h3><p>À chaque push sur main: tests automatiques → déploiement automatique si les tests passent.</p>
Cet article vous a-t-il été utile?
Articles similaires