Files
alapatch/.gitea/workflows/deploy.yml
T
cvancau f8834ac584
Deploy to home (Isolated Port) / deploy (push) Failing after 7s
Actualiser .gitea/workflows/deploy.yml
2026-08-09 14:30:58 +02:00

45 lines
1.4 KiB
YAML

name: Deploy to home (Isolated Port)
on:
push:
branches:
- main
workflow_dispatch:
jobs:
deploy:
runs-on: [self-hosted, linux]
steps:
# 1. Récupération du code source sur le Runner
- name: Checkout Code
uses: actions/checkout@v4
# 2. Compilation de l'application sur le Runner Gitea
- name: Build Application Locally
run: |
npm install --legacy-peer-deps
npm run build
# 3. Déploiement isolé vers le serveur home
- name: Deploy to Isolated Directory
run: |
# Envoie le dossier build compilé dans un répertoire dédié /opt/alapatch-dist
tar -czf - -C build . | ssh -o StrictHostKeyChecking=no -i /root/.ssh/id_home root@home.mesdonneesadministratives.fr "
mkdir -p /opt/alapatch-dist &&
tar -xzf - -C /opt/alapatch-dist &&
# Installe l'utilitaire http-server globalement si absent pour gérer le port
if ! command -v http-server &> /dev/null; then
npm install -g http-server
fi &&
# Arrête proprement l'ancien serveur de test s'il tourne sur le port 4321
fuser -k 4321/tcp || true &&
# Lance le serveur en arrière-plan sur le port 4321
nohup http-server /opt/alapatch-dist -p 4321 -a 0.0.0.0 > /dev/null 2>&1 &
"