diff --git a/.gitea/workflows/sgeupdated.yml b/.gitea/workflows/sgeupdated.yml index dae3b2d..f498759 100644 --- a/.gitea/workflows/sgeupdated.yml +++ b/.gitea/workflows/sgeupdated.yml @@ -13,6 +13,7 @@ concurrency: jobs: deploy: runs-on: ubuntu-latest + steps: - name: Checkout repo uses: actions/checkout@v3 @@ -28,7 +29,9 @@ jobs: set -euo pipefail cd /home/ubuntu/Bgreen/sgeUpdated - git fetch origin main + + echo "đŸ“Ļ Fetching latest code from your fork..." + git fetch myfork main # Detect which files changed in the last commit CHANGED_FILES=$(git diff --name-only HEAD HEAD~1) @@ -36,7 +39,8 @@ jobs: echo "đŸĒļ Changed files:" echo "$CHANGED_FILES" - git reset --hard origin/main + echo "🔄 Resetting to your fork's main branch..." + git reset --hard myfork/main BACKEND_CHANGED=false FRONTEND_CHANGED=false @@ -51,19 +55,18 @@ jobs: FRONTEND_CHANGED=true fi - - # Backend section - #if [ "$BACKEND_CHANGED" = true ]; then - #echo "⚡ Backend changes detected." - #cd sgeUpdated/sge-backend - #echo "Running Maven build..." - #/opt/apache-maven-3.9.11/bin/mvn clean install -DskipTests - # cd ../.. - #echo "Rebuilding backend Docker container..." - #docker compose up -d --build bgreen-backend - #else - #echo "✅ No backend changes." - #fi + # Backend section (currently commented out) + # if [ "$BACKEND_CHANGED" = true ]; then + # echo "⚡ Backend changes detected." + # cd sgeUpdated/sge-backend + # echo "Running Maven build..." + # /opt/apache-maven-3.9.11/bin/mvn clean install -DskipTests + # cd ../.. + # echo "Rebuilding backend Docker container..." + # docker compose up -d --build bgreen-backend + # else + # echo "✅ No backend changes." + # fi # Frontend section if [ "$FRONTEND_CHANGED" = true ]; then @@ -74,16 +77,15 @@ jobs: # npm run build cd ../.. echo "Rebuilding frontend Docker container..." - docker compose up -d --build bgreen-frontend else echo "✅ No frontend changes." fi - # If no changes at all, just restart containers (commented out for now) - #if [ "$BACKEND_CHANGED" = false ] && [ "$FRONTEND_CHANGED" = false ]; then - #echo "â™ģī¸ No source changes detected. (Would restart containers here...)" - #docker compose up -d - #fi + # If no changes at all, just restart containers (optional) + if [ "$BACKEND_CHANGED" = false ] && [ "$FRONTEND_CHANGED" = false ]; then + echo "â™ģī¸ No source changes detected. Restarting containers..." + docker compose up -d + fi - echo "✅ Check complete. (No rebuild or restart performed.)" + echo "✅ Deployment check complete."