Data2025/deploy-frontend.sh

19 lines
596 B
Bash

#!/bin/bash
cd "$(dirname "$0")/src/main/angular/" || exit 1
if git diff --quiet && git diff --cached --quiet && [ -z "$(git ls-files --others --exclude-standard)" ]; then
if ng build; then
TAG="DEPLOY---FRONTEND---$(date +'%Y-%m-%d---%H-%M-%S')"
git rev-parse HEAD > dist/angular/browser/git.hash
echo "$TAG" > dist/angular/browser/git.tag
rsync --archive --delete -e 'ssh -p2222' dist/angular/browser/ root@10.255.0.1:/srv/Data2025/www/ --progress
git tag "$TAG"
else
echo "ng build failed! Aborting..."
fi
else
echo "git has changes! Aborting..."
exit 1
fi