From 3072935dde70e0a58fea32c7a6dcdc705defbd00 Mon Sep 17 00:00:00 2001 From: Puechberty Arthur Date: Tue, 5 May 2026 20:07:44 +0200 Subject: [PATCH] =?UTF-8?q?feat:=20ajouter=20un=20workflow=20GitHub=20Acti?= =?UTF-8?q?ons=20pour=20le=20d=C3=A9ploiement=20en=20production?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy.yml | 45 ++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..8266df8 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,45 @@ +name: Deploy Production + +on: + push: + branches: [main] + +concurrency: + group: production-deploy + cancel-in-progress: true + +jobs: + deploy: + runs-on: self-hosted + + steps: + - name: Deploy portfolio Production + shell: bash + run: | + set -euo pipefail + + echo "============================" + echo " Starting deployment" + echo "============================" + + APP_DIR="/srv/apps/portfolio" + + 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 "Cleaning unused Docker images..." + docker image prune -f + + echo "Deployment finished successfully"