Update sgeupdated pipeline v23++++

This commit is contained in:
2025-10-23 13:04:06 +03:00
parent 614cbe8b04
commit 871bcf9651

View File

@@ -15,6 +15,9 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Deploy over SSH - name: Deploy over SSH
uses: appleboy/ssh-action@v1.0.3 uses: appleboy/ssh-action@v1.0.3
with: with:
@@ -25,6 +28,7 @@ jobs:
script: | script: |
set -euo pipefail set -euo pipefail
# Go to your repo
cd /home/ubuntu/Bgreen/sgeUpdated cd /home/ubuntu/Bgreen/sgeUpdated
echo "📦 Fetching latest code from your fork..." echo "📦 Fetching latest code from your fork..."
@@ -51,37 +55,43 @@ jobs:
FRONTEND_CHANGED=true FRONTEND_CHANGED=true
fi fi
# Backend section (currently commented out) ############################
# if [ "$BACKEND_CHANGED" = true ]; then # Backend section (optional)
# echo "⚡ Backend changes detected." ############################
# cd sgeUpdated/sge-backend if [ "$BACKEND_CHANGED" = true ]; then
# echo "Running Maven build..." echo "⚡ Backend changes detected."
# /opt/apache-maven-3.9.11/bin/mvn clean install -DskipTests echo "Running Maven build for backend..."
# cd ../.. cd /home/ubuntu/Bgreen/sgeUpdated/sge-backend
# echo "Rebuilding backend Docker container..." /opt/apache-maven-3.9.11/bin/mvn clean install -DskipTests
# docker compose up -d --build bgreen-backend cd /home/ubuntu/Bgreen
# else echo "Rebuilding backend container..."
# echo "✅ No backend changes." docker compose -f /home/ubuntu/Bgreen/docker-compose.yml up -d --build bgreen-backend
# fi else
echo "✅ No backend changes."
fi
############################
# Frontend section # Frontend section
############################
if [ "$FRONTEND_CHANGED" = true ]; then if [ "$FRONTEND_CHANGED" = true ]; then
echo "⚡ Frontend changes detected." echo "⚡ Frontend changes detected."
cd sgeUpdated/sge-frontend cd /home/ubuntu/Bgreen/sgeUpdated/sge-frontend
echo "Running npm build..." echo "Running npm build for frontend..."
# npm install # npm install
# npm run build # npm run build
cd ../.. cd /home/ubuntu/Bgreen
echo "Rebuilding frontend Docker container..." echo "Rebuilding frontend container..."
docker compose up -d --build bgreen-frontend docker compose -f /home/ubuntu/Bgreen/docker-compose.yml up -d --build bgreen-frontend
else else
echo "✅ No frontend changes." echo "✅ No frontend changes."
fi fi
# If no changes at all, just restart containers (optional) ############################
# If no changes at all
############################
if [ "$BACKEND_CHANGED" = false ] && [ "$FRONTEND_CHANGED" = false ]; then if [ "$BACKEND_CHANGED" = false ] && [ "$FRONTEND_CHANGED" = false ]; then
echo "♻️ No source changes detected. Restarting containers..." echo "♻️ No source changes detected. Restarting containers..."
docker compose up -d docker compose -f /home/ubuntu/Bgreen/docker-compose.yml up -d
fi fi
echo "✅ Deployment check complete." echo "✅ Deployment check complete."