e82ec21300
This workflow automates the deployment of a Laravel application to a server via SSH when changes are pushed to the main branch.
24 lines
720 B
YAML
24 lines
720 B
YAML
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
|