35 lines
1.2 KiB
YAML
35 lines
1.2 KiB
YAML
name: Deploy to home
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: [self-hosted, linux]
|
|
|
|
steps:
|
|
- name: Deploy via SSH
|
|
shell: bash
|
|
run: |
|
|
echo "Démarrage de la connexion vers le serveur distant..."
|
|
|
|
# Ajout de -o BatchMode=yes et séparation des étapes pour forcer l'affichage des logs
|
|
ssh -o StrictHostKeyChecking=no -o BatchMode=yes -i /root/.ssh/id_home root@home.mesdonneesadministratives.fr "
|
|
cd /opt/alapatch &&
|
|
echo '=> Fetching...' && git fetch --all &&
|
|
echo '=> Resetting...' && git reset --hard origin/main &&
|
|
echo '=> Building Docker...' && docker build -t alapatch-prod . &&
|
|
echo '=> Cleaning old containers...' &&
|
|
if [ \$(docker ps -aq -f name=microkorg-editor) ]; then
|
|
docker stop microkorg-editor && docker rm microkorg-editor;
|
|
fi &&
|
|
echo '=> Running new container...' &&
|
|
docker run -d --restart unless-stopped -p 4321:4321 --name microkorg-editor alapatch-prod
|
|
"
|
|
|
|
echo "Le script de déploiement distant a été exécuté."
|
|
|