From cd209d17989e86f70e811467ac6d40084aea7b2d Mon Sep 17 00:00:00 2001 From: Puechberty Arthur Date: Thu, 23 Apr 2026 01:21:16 +0200 Subject: [PATCH] =?UTF-8?q?feat:=20am=C3=A9lioration=20du=20workflow=20de?= =?UTF-8?q?=20d=C3=A9ploiement=20avec=20des=20=C3=A9tapes=20de=20nettoyage?= =?UTF-8?q?=20et=20de=20r=C3=A9cup=C3=A9ration=20du=20code?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy.yml | 36 +++++++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index d0bcd13..bcbdf61 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -4,20 +4,42 @@ on: push: branches: [main] +concurrency: + group: production-deploy + cancel-in-progress: true + jobs: deploy: runs-on: self-hosted steps: - - name: Deploy on server + - name: Deploy Flint Production + shell: bash run: | - cd /srv/apps/Flint + set -euo pipefail - echo "Pull latest code" - git pull origin main + echo "============================" + echo " Starting deployment" + echo "============================" - echo "Build & restart containers" + APP_DIR="/srv/apps/Flint" + + cd "$APP_DIR" + + echo "Fetching latest code..." + git fetch origin main + + echo "Resetting local state..." + git reset --hard origin/main + + echo "Cleaning untracked files (keeping .env)" + git clean -fd -e .env + + echo "Pulling/building containers..." + docker compose pull || true docker compose up -d --build --remove-orphans - echo "Cleanup old images" - docker image prune -f \ No newline at end of file + echo "Cleaning unused Docker images..." + docker image prune -f + + echo "Deployment finished successfully" \ No newline at end of file