thunderhub/scripts/updateToLatest.sh

33 lines
716 B
Bash
Raw Permalink Normal View History

2021-12-11 11:33:32 -05:00
#!/bin/sh
# fetch latest master
echo "Checking for changes upstream ..."
git fetch
UPSTREAM=${1:-'@{u}'}
LOCAL=$(git rev-parse @)
REMOTE=$(git rev-parse "$UPSTREAM")
if [ $LOCAL = $REMOTE ]; then
TAG=$(git tag | sort -V | tail -1)
echo "You are up-to-date on version" $TAG
else
echo "Reseting repository..."
git reset --hard
echo "Pulling latest changes..."
git pull -p
# install deps
echo "Installing dependencies..."
npm install --quiet
# build app
2021-12-11 11:33:32 -05:00
echo "Building application..."
npm run build
# remove dev deps
echo "Removing unnecessary modules..."
npm prune --omit=dev
2021-12-11 11:33:32 -05:00
TAG=$(git tag | sort -V | tail -1)
echo "Updated to version" $TAG
fi