From e9a361489e6dbc9d41ad9874a581d8c6d1e75ac9 Mon Sep 17 00:00:00 2001 From: Abdulbari Date: Sat, 30 Aug 2025 02:56:08 +0300 Subject: [PATCH] Update sgeupdated pipeline v12 a new update that fixed the docker files problem, it deletes the old ones then builds the new accordingly --- .gitea/workflows/sgeupdated.yml | 53 +++++++++++++++++++-------------- 1 file changed, 31 insertions(+), 22 deletions(-) diff --git a/.gitea/workflows/sgeupdated.yml b/.gitea/workflows/sgeupdated.yml index 0f3809f..ee5e168 100644 --- a/.gitea/workflows/sgeupdated.yml +++ b/.gitea/workflows/sgeupdated.yml @@ -32,27 +32,36 @@ jobs: cd/home/ubuntu/sgeUpdated git pull origin main - # --- Backend --- - if echo "${CHANGED_FILES}" | grep -q "sge-backend"; then - echo "Backend changes detected..." - cd sge-backend - mvn clean install - cd .. - docker build -t bgreen-backend ./sge-backend - docker compose up -d --force-recreate backend - fi + # --- Backend --- + if echo "${CHANGED_FILES}" | grep -q "sge-backend"; then + echo "Backend changes detected..." + cd sge-backend + mvn clean install + cd .. - # --- Frontend --- - if echo "${CHANGED_FILES}" | grep -q "sge-frontend"; then - echo "Frontend changes detected..." - cd sge-frontend - if echo "${CHANGED_FILES}" | grep -q "sge-frontend/package.json"; then - echo "package.json changed → installing dependencies" - npm install - fi - npm run build - cd .. - docker build -t bgreen-frontend ./sge-frontend - docker compose up -d --force-recreate frontend - fi + # Stop & remove old backend container (ignore errors if not exists) + docker stop sgeupdated-backend-1 || true + docker rm sgeupdated-backend-1 || true + # Build Docker image and restart container + docker compose build --no-cache backend + docker compose up -d --force-recreate backend + fi + + # --- Frontend --- + if echo "${CHANGED_FILES}" | grep -q "sge-frontend"; then + echo "Frontend changes detected..." + cd sge-frontend + + npm install + npm run build + cd .. + + # Stop & remove old frontend container (ignore errors if not exists) + docker stop sgeupdated-frontend-1 || true + docker rm sgeupdated-frontend-1 || true + + # Build Docker image and restart container + docker compose build --no-cache frontend + docker compose up -d --force-recreate frontend + fi