41 lines
1.4 KiB
YAML
41 lines
1.4 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 forcée..."
|
|
|
|
ssh -o StrictHostKeyChecking=no -o BatchMode=yes -i /root/.ssh/id_home root@git.mesdonneesadministratives.fr "
|
|
cd /opt/alapatch &&
|
|
|
|
echo '=> [1/4] Redéfinition du remote vers Gitea...' &&
|
|
git remote set-url origin https://mesdonneesadministratives.fr || git remote add origin https://git.mesdonneesadministratives.fr &&
|
|
|
|
echo '=> [2/4] Nettoyage et Synchronisation...' &&
|
|
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 !'
|
|
"
|