diff --git a/.gitea/workflows/sgeupdated.yml b/.gitea/workflows/sgeupdated.yml index d3567f3..4f4811b 100644 --- a/.gitea/workflows/sgeupdated.yml +++ b/.gitea/workflows/sgeupdated.yml @@ -27,47 +27,23 @@ jobs: script_stop: true script: | set -euo pipefail + cd /home/ubuntu/sgeUpdated - - # --- Save old commit SHA --- - OLD_SHA=$(git rev-parse HEAD || true) - - # --- Update repo --- git fetch origin main git reset --hard origin/main - # --- Save new commit SHA --- - NEW_SHA=$(git rev-parse HEAD) + echo "⚡ Rebuilding Backend..." + cd sge-backend + mvn clean install -DskipTests + cd .. + docker compose up -d --build backend - echo "🔍 Detecting changes..." - CHANGED_FILES=$(git diff --name-only $OLD_SHA $NEW_SHA || true) - echo "Changed files: $CHANGED_FILES" + echo "⚡ Rebuilding Frontend..." + cd sge-frontend + npm install + npm run build + cd .. + docker compose up -d --build frontend - # --- Skip deploy if no backend/frontend changes --- - if ! echo "$CHANGED_FILES" | grep -E "(^|/)sge-(frontend|backend)/"; then - echo "✅ No frontend/backend changes detected. Skipping Docker rebuild." - exit 0 - fi - - # --- Backend --- - if echo "$CHANGED_FILES" | grep -E "(^|/)sge-backend/"; then - echo "⚙️ Backend changes detected. Rebuilding backend..." - cd sge-backend - mvn clean install -DskipTests - cd .. - docker compose up -d --build backend - else - echo "✅ No backend changes detected." - fi - - # --- Frontend --- - if echo "$CHANGED_FILES" | grep -E "(^|/)sge-frontend/"; then - echo "⚙️ Frontend changes detected. Rebuilding frontend..." - cd sge-frontend - npm install - npm run build - cd .. - docker compose up -d --build frontend - else - echo "✅ No frontend changes detected." - fi + echo "✅ Deployment complete. Current containers:" + docker ps --format 'table {{.Names}}\t{{.Status}}\t{{.Ports}}'