forked from Abdulbari/sgeUpdated
update to sgeupdated pipeline v20+++
This commit is contained in:
@@ -4,8 +4,8 @@ name: sgeUpdated CI/CD
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main # trigger only when code is merged into main
|
||||||
workflow_dispatch:
|
workflow_dispatch: # allow manual trigger
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: sgeupdated-deploy-${{ github.ref }}
|
group: sgeupdated-deploy-${{ github.ref }}
|
||||||
@@ -32,30 +32,20 @@ jobs:
|
|||||||
git fetch origin main
|
git fetch origin main
|
||||||
git reset --hard origin/main
|
git reset --hard origin/main
|
||||||
|
|
||||||
# Rebuild backend if it has changed
|
echo "⚡ Rebuilding Backend..."
|
||||||
if git diff --name-only HEAD~1 HEAD | grep -q "^sge-backend/"; then
|
cd sge-backend
|
||||||
echo "⚡ Rebuilding Backend..."
|
/opt/apache-maven-3.9.11/bin/mvn clean install -DskipTests
|
||||||
cd sge-backend
|
cd ..
|
||||||
/opt/apache-maven-3.9.11/bin/mvn clean install -DskipTests
|
docker compose up -d --build backend
|
||||||
cd ..
|
|
||||||
docker compose up -d --build backend
|
|
||||||
else
|
|
||||||
echo "✅ Backend unchanged, skipping rebuild."
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Rebuild frontend if it has changed
|
echo "⚡ Rebuilding Frontend..."
|
||||||
if git diff --name-only HEAD~1 HEAD | grep -q "^sge-frontend/"; then
|
cd sge-frontend
|
||||||
echo "⚡ Rebuilding Frontend..."
|
rm -rf node_modules package-lock.json
|
||||||
cd sge-frontend
|
npm cache clean --force
|
||||||
rm -rf node_modules package-lock.json
|
npm install
|
||||||
npm cache clean --force
|
npm run build
|
||||||
npm install
|
cd ..
|
||||||
npm run build
|
docker compose up -d --build frontend
|
||||||
cd ..
|
|
||||||
docker compose up -d --build frontend
|
|
||||||
else
|
|
||||||
echo "✅ Frontend unchanged, skipping rebuild."
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "✅ Deployment complete. Current containers:"
|
echo "✅ Deployment complete. Current containers:"
|
||||||
docker ps --format 'table {{.Names}}\t{{.Status}}\t{{.Ports}}'
|
docker ps --format 'table {{.Names}}\t{{.Status}}\t{{.Ports}}'
|
||||||
Reference in New Issue
Block a user