Add auto deploy workflow for ML API

This commit is contained in:
hakimlutfi46 2026-05-15 01:05:21 +07:00
parent e13c7ffd76
commit 4c803f2570
1 changed files with 35 additions and 0 deletions

35
.github/workflows/deploy.yml vendored Normal file
View File

@ -0,0 +1,35 @@
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