-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(deploy): simplify and clean up deploy workflow
Reduced steps and streamlined tasks in the GitHub Actions deploy workflow to optimize the deployment process. Updated comments and naming conventions for better clarity.
- Loading branch information
frederic moras
committed
Dec 25, 2024
1 parent
e866c00
commit 74b9711
Showing
2 changed files
with
13 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,35 @@ | ||
name: Deploy Application | ||
name: Deploy to Server | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- main # Déclencher l'action sur les push vers la branche main | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
# 1. Vérifier le dépôt | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up SSH | ||
# 2. Configurer SSH | ||
- name: Setup SSH | ||
run: | | ||
mkdir -p ~/.ssh | ||
echo "${{ secrets.SSH_PRIVATE_KEY }}" | ||
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa | ||
chmod 600 ~/.ssh/id_rsa | ||
cat ~/.ssh/id_rsa | ||
ssh-keyscan -H 207.154.255.72 >> ~/.ssh/known_hosts | ||
- name: Set up PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: '8.3' | ||
extensions: mbstring, bcmath, ctype, fileinfo, json, tokenizer, xml, pdo_mysql | ||
|
||
- name: Install Composer dependencies | ||
run: composer install --no-dev --optimize-autoloader | ||
|
||
- name: Test SSH Connection | ||
# 3. Déployer sur le serveur | ||
- name: Deploy application | ||
run: | | ||
ssh -o StrictHostKeyChecking=no -i ~/.ssh/id_rsa [email protected] echo "SSH connection successful" | ||
- name: Deploy using SSH | ||
uses: appleboy/[email protected] | ||
with: | ||
host: 207.154.255.72 | ||
username: root | ||
key: ${{ secrets.SSH_PRIVATE_KEY }} | ||
port: 22 | ||
script: | | ||
ssh -o StrictHostKeyChecking=no [email protected] << 'EOF' | ||
cd /var/www/laravel | ||
git fetch origin | ||
git checkout main | ||
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 | ||
|
@@ -56,6 +39,7 @@ jobs: | |
chmod -R 775 storage bootstrap/cache | ||
php artisan queue:restart | ||
php artisan cache:clear | ||
EOF | ||
- name: Notify Deployment Success | ||
run: echo "Deployment completed successfully!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
@extends('Layouts.app') | ||
|
||
@section('title') | ||
Acceuil | ||
Boom Acceuil | ||
@endsection | ||
|
||
@section('content') | ||
|