19 lines
581 B
Bash
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" |