Add GitHub Actions workflow for Laravel deployment

This workflow automates the deployment of a Laravel application to a server via SSH when changes are pushed to the main branch.
This commit is contained in:
Sam Depardieu
2026-03-25 22:41:27 +01:00
committed by GitHub
parent 124fd240ae
commit e82ec21300
+23
View File
@@ -0,0 +1,23 @@
name: Deploy Laravel App
on:
push:
branches: [ main ] # Déclenche le déploiement lors d'un push sur la branche main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Deploy to Server via SSH
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
script: |
cd /home/sam/mon-app-laravel
git pull origin main
docker-compose up -d --build
docker exec laravel_app php artisan migrate --force
docker exec laravel_app php artisan config:cache
docker exec laravel_app php artisan route:cache