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