#!/bin/bash

ACCOUNT="wibix"

# increase version
# read -p "Press Y/y to deploy with a new version: " choice

# if [[ "$choice" == "Y" || "$choice" == "y" ]]; then
#     npm version patch
#     if [ $? -eq 0 ]; then
#         echo "VERSION: $(npm pkg get version | xargs echo)"
#     else
#         exit
#     fi
# else
#     echo "'$choice' not 'Y' or 'y'. Exiting..."
# fi

npm run build --prod || echo_error "Failed to build"

rsync -ahP \
  --exclude '.git/' \
  --exclude '.direnv/' \
  . $ACCOUNT@server:/home/$ACCOUNT/app || echo_error "Failed to deploy web"

echo_success "🚀 Deployed to production successfully!"
