From 5f8de8105b85ee88837d8cb298710eb13ce7934b Mon Sep 17 00:00:00 2001 From: Abdulbari Date: Mon, 1 Sep 2025 05:09:20 +0300 Subject: [PATCH] update to sgeupdated pipeline v21 --- .gitea/workflows/sgeupdated.yml | 40 ++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/.gitea/workflows/sgeupdated.yml b/.gitea/workflows/sgeupdated.yml index 69321ef..77ed082 100644 --- a/.gitea/workflows/sgeupdated.yml +++ b/.gitea/workflows/sgeupdated.yml @@ -4,8 +4,8 @@ name: sgeUpdated CI/CD on: push: branches: - - main # trigger only when code is merged into main - workflow_dispatch: # allow manual trigger + - main + workflow_dispatch: concurrency: group: sgeupdated-deploy-${{ github.ref }} @@ -32,20 +32,30 @@ jobs: git fetch origin main git reset --hard origin/main - echo "⚡ Rebuilding Backend..." - cd sge-backend - /opt/apache-maven-3.9.11/bin/mvn clean install -DskipTests - cd .. - docker compose up -d --build backend + # Rebuild backend if it has changed + if git diff --name-only HEAD~1 HEAD | grep -q "^sge-backend/"; then + echo "⚡ Rebuilding Backend..." + cd sge-backend + /opt/apache-maven-3.9.11/bin/mvn clean install -DskipTests + cd .. + docker compose up -d --build backend + else + echo "✅ Backend unchanged, skipping rebuild." + fi - echo "⚡ Rebuilding Frontend..." - cd sge-frontend - rm -rf node_modules package-lock.json - npm cache clean --force - npm install - npm run build - cd .. - docker compose up -d --build frontend + # Rebuild frontend if it has changed + if git diff --name-only HEAD~1 HEAD | grep -q "^sge-frontend/"; then + echo "⚡ Rebuilding Frontend..." + cd sge-frontend + rm -rf node_modules package-lock.json + npm cache clean --force + npm install + npm run build + cd .. + docker compose up -d --build frontend + else + echo "✅ Frontend unchanged, skipping rebuild." + fi echo "✅ Deployment complete. Current containers:" docker ps --format 'table {{.Names}}\t{{.Status}}\t{{.Ports}}'