-
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.
- Loading branch information
1 parent
605e7b7
commit 20cb283
Showing
1 changed file
with
33 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: CI/CD Pipeline | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
# Déploiement sur le serveur Hostinger | ||
- name: Deploy to Hostinger Server | ||
env: | ||
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} # Clé SSH privée pour Hostinger | ||
SERVER_IP: ${{ secrets.SERVER_IP }} # IP du serveur Hostinger | ||
SERVER_USER: "root" # Utilisateur SSH (à adapter si nécessaire) | ||
run: | | ||
echo "$SSH_PRIVATE_KEY" > private_key # Crée un fichier temporaire pour la clé privée | ||
chmod 600 private_key # Fixe les permissions pour la clé | ||
ssh -i private_key -o StrictHostKeyChecking=no $SERVER_USER@$SERVER_IP << 'EOF' | ||
cd /root/project/mamaz_yoga_back/mamaz_yoga_back | ||
sudo docker-compose down # Arrête les anciens conteneurs | ||
sudo docker-compose pull # Tire les dernières images si nécessaire | ||
sudo docker-compose up -d --build # Reconstruit et démarre les conteneurs en arrière-plan | ||
EOF |