34 lines
1.0 KiB
YAML
34 lines
1.0 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 "Vérification locale de la clé SSH sur le Runner..."
|
|
if [ ! -f /root/.ssh/id_home ]; then
|
|
echo "ERREUR : La clé /root/.ssh/id_home est introuvable sur ce Runner !"
|
|
exit 1
|
|
fi
|
|
|
|
echo "Tentative de connexion et réplication..."
|
|
|
|
# L'option -v (Verbose) va nous afficher TOUT le protocole de connexion dans les logs
|
|
ssh -v -o StrictHostKeyChecking=no -o BatchMode=yes -i /root/.ssh/id_home root@home.mesdonneesadministratives.fr "
|
|
cd /opt/alapatch &&
|
|
echo '=> Dossier actuel :' && pwd &&
|
|
echo '=> Statut Git avant :' && git status &&
|
|
git fetch --all &&
|
|
git reset --hard origin/main &&
|
|
echo '=> Statut Git après :' && git log -1 --oneline
|
|
"
|