-
Notifications
You must be signed in to change notification settings - Fork 0
45 lines (39 loc) · 1.32 KB
/
deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
name: Deploy to Server
on:
push:
branches:
- main # Déclencher l'action sur les push vers la branche main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
# 1. Vérifier le dépôt
- name: Checkout repository
uses: actions/checkout@v3
# 2. Configurer SSH
- name: Setup SSH
run: |
mkdir -p ~/.ssh
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan -H 207.154.255.72 >> ~/.ssh/known_hosts
# 3. Déployer sur le serveur
- name: Deploy application
run: |
ssh -o StrictHostKeyChecking=no [email protected] << 'EOF'
cd /var/www/laravel
git pull origin main
# Ajouter des commandes spécifiques pour votre application
npm install
composer install --no-dev --optimize-autoloader
php artisan migrate --force
php artisan config:cache
php artisan route:cache
php artisan view:cache
chown -R www-data:www-data storage bootstrap/cache
chmod -R 775 storage bootstrap/cache
php artisan queue:restart
php artisan cache:clear
EOF
- name: Notify Deployment Success
run: echo "Deployment completed successfully!"