diff --git a/deploy-backend.sh b/deploy-backend.sh new file mode 100644 index 0000000..4727294 --- /dev/null +++ b/deploy-backend.sh @@ -0,0 +1,19 @@ +#!/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" \ No newline at end of file