Data2025/deploy-backend.sh
2025-11-03 11:54:42 +01:00

19 lines
581 B
Bash

#!/bin/bash
cd "$(dirname "$0")" || exit 1
if ! ( git diff --quiet && git diff --cached --quiet && [ -z "$(git ls-files --others --exclude-standard)" ] ); then
echo "git has changes! Aborting..."
exit 1
fi
if ! mvn clean install; then
echo "mvn clean install failed! Aborting..."
exit 1
fi
TAG="DEPLOY---BACKEND---$(date +'%Y-%m-%d---%H-%M-%S')"
ssh root@10.255.0.1 -p 2222 "systemctl stop Data2025.service"
rsync -e 'ssh -p2222' target/Data2025.jar root@10.255.0.1:/srv/Data2025/ --progress
ssh root@10.255.0.1 -p 2222 "systemctl start Data2025.service"
git tag "$TAG"