79 lines
1.9 KiB
YAML
79 lines
1.9 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 "==> État des conteneurs"
|
|
docker compose ps
|
|
|
|
echo "==> Logs frontend (30s)"
|
|
sleep 30
|
|
docker compose logs --tail=50 frontend
|
|
|
|
echo "==> Vérification santé"
|
|
for i in $(seq 1 12); do
|
|
if curl -sf http://localhost:4000 | grep -q "html"; then
|
|
echo "Déploiement OK"
|
|
exit 0
|
|
fi
|
|
echo " Attente... ($i/12)"
|
|
sleep 5
|
|
done
|
|
echo "Échec : le frontend ne répond pas après 60s"
|
|
exit 1
|