when: - branch: - main - stand-alone event: push steps: # Etape 1 : Build de l'application statique # Les vars CI (CI_REPO_OWNER, CI_COMMIT_BRANCH) sont injectees automatiquement par Woodpecker - name: build image: node:20-alpine environment: NODE_ENV: production HUSKY: 0 HUSKY_SKIP_INSTALL: 1 commands: - apk add --no-cache git python3 - npm ci --legacy-peer-deps - cd radar-app && npm ci --legacy-peer-deps --include=dev && npm run build:icons && cd .. - node scripts/generate-team-visualization-data.js - npm run build - ls -la build/ | head -10 # Etape 2 : Deploiement sur sonic via Docker socket # NOTE: from_secret et volumes: incompatibles dans le meme step (bug Woodpecker next) # Aucun secret ici — les variables de build sont dans docker-compose.business.yml - name: deploy image: docker:27-cli volumes: - /var/run/docker.sock:/var/run/docker.sock commands: - docker compose -f docker-compose.business.yml build --no-cache - docker compose -f docker-compose.business.yml up -d --remove-orphans - docker compose -f docker-compose.business.yml ps # Etape 3 : Healthcheck post-deploiement - name: healthcheck image: alpine:3.20 commands: - apk add --no-cache --quiet curl - | MAX=20 i=0 until [ $i -ge $MAX ]; do CODE=$(curl -sSo /dev/null -w "%{http_code}" http://localhost:3006/ 2>/dev/null) echo "Tentative $((i+1))/$MAX - HTTP $CODE" if [ "$CODE" = "200" ]; then echo "Radar repond sur http://localhost:3006/" exit 0 fi i=$((i+1)) sleep 5 done echo "ERREUR: Radar ne repond pas apres $(($MAX * 5)) secondes" exit 1 # Notification en cas d'echec - name: notify-failure image: alpine:3.20 commands: - 'echo "ECHEC pipeline #$CI_BUILD_NUMBER sur commit $CI_COMMIT_SHA"' - 'echo "Branche: $CI_COMMIT_BRANCH"' when: - status: failure