Files
konstitisyon.nu/.gitea/workflows/deploy-beta.yaml
T
cedric 310d5abb8b
Déploiement Frontend BETA / Lint et tests (push) Successful in 1m57s
Déploiement Frontend BETA / Déploiement beta (push) Failing after 1m23s
deploy: change health check strategy
2026-05-15 21:51:13 +04:00

73 lines
1.8 KiB
YAML

name: Déploiement Frontend BETA
run-name: ${{ gitea.actor }} déploie Frontend BETA
on:
push:
branches:
- dev
jobs:
test:
name: Lint et tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '22'
- name: Activer Yarn via Corepack
run: corepack enable
- name: Installer les dépendances
run: yarn install --frozen-lockfile
- name: Lint
run: yarn lint
- name: Tests
run: yarn test
deploy:
name: Déploiement beta
needs: test
runs-on: ubuntu-latest
steps:
- name: Déployer sur le serveur
uses: appleboy/ssh-action@v1.2.0
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
port: ${{ secrets.SSH_PORT }}
script: |
set -e
cd ${{ secrets.DEPLOY_PATH }}
echo "==> Correction des permissions"
sudo chown -R "$(whoami):" .
echo "==> Synchronisation branche dev"
git fetch origin dev
git reset --hard origin/dev
echo "==> Réseau Docker"
docker network inspect konstitisyon_network >/dev/null 2>&1 \
|| docker network create konstitisyon_network
echo "==> Build et démarrage du frontend"
docker compose up -d --build
echo "==> Vérification santé"
for i in $(seq 1 12); do
status=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:4000)
if echo "$status" | grep -qE "^[23]"; then
echo "Déploiement OK (HTTP $status)"
exit 0
fi
echo " Attente... ($i/12) [HTTP $status]"
sleep 5
done
echo "Échec : le frontend ne répond pas après 60s"
exit 1