MIF_E31230910_MP-HRIS-ML/.github/workflows/deploy.yml

35 lines
837 B
YAML

name: Auto Deploy HRISMP ML API
on:
push:
branches:
- main
jobs:
deploy:
runs-on: self-hosted
steps:
- name: Deployment Logic HRISMP ML API
run: |
cd /www/wwwroot/joule/mp-hris-ml
OLD_COMMIT=$(git rev-parse HEAD)
git fetch --all
git reset --hard origin/main
NEW_COMMIT=$(git rev-parse HEAD)
if [ "$OLD_COMMIT" != "$NEW_COMMIT" ]; then
echo " Update detected. Rebuilding ML API..."
docker compose down
docker compose up -d --build
docker image prune -f
else
echo "No changes detected. Skip rebuild."
fi
echo "Checking ML API health..."
sleep 5
curl -f http://127.0.0.1:8002/health || exit 1