Files
alapatch/.gitea/workflows/deploy.yml
T
cvancau 0e37e535d4
Deploy to home / deploy (push) Failing after 1s
Actualiser .gitea/workflows/deploy.yml
2026-08-09 15:48:38 +02:00

44 lines
1.7 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 et réplication Git native..."
ssh -o StrictHostKeyChecking=no -o BatchMode=yes -i /root/.ssh/id_home root@home.mesdonneesadministratives.fr "
cd /opt/alapatch &&
echo '=> [1/4] Configuration du Remote en SSH natif...' &&
git remote set-url origin git@git.mesdonneesadministratives.fr:cvancau/alapatch.git || git remote add origin git@git.mesdonneesadministratives.fr:cvancau/alapatch.git &&
echo '=> [2/4] Synchronisation Git native...' &&
# On laisse Git chercher la clé tout seul (comme pour votre autre dépôt)
# On lui demande juste d'ignorer la vérification de l'hôte
git config core.sshCommand 'ssh -o StrictHostKeyChecking=no -o BatchMode=yes' &&
git fetch --all &&
git reset --hard origin/main &&
git clean -fd &&
echo '=> [3/4] Build de l-image Docker (Node 22 / Vite)...' &&
docker build -t alapatch-prod . &&
echo '=> [4/4] Recyclage du conteneur sur le port 4321...' &&
if [ \$(docker ps -aq -f name=microkorg-editor) ]; then
docker stop microkorg-editor && docker rm microkorg-editor;
fi &&
docker run -d --restart unless-stopped -p 4321:4321 --name microkorg-editor alapatch-prod &&
echo '=> Déploiement terminé avec succès !'
"