#!/bin/bash

set -ex

latest_jar () {
  $(ls -tr target/uberjar/*standalone.jar | tail -1)
}
sudo systemctl stop timetracker.service

cd /home/timetracker/time-tracker
sudo -H -u timetracker git pull
source /home/timetracker/env.sh
sudo -H -u timetracker /home/timetracker/lein uberjar
sudo -H -u timetracker cp /home/timetracker/time-tracker.jar /home/timetracker/time-tracker-$(date +%s).jar
cp $(latest_jar) /home/timetracker/time-tracker.jar

sudo systemctl start timetracker.service

#!/bin/bash

RELEASE_TAG=$1
DEPLOY_DIR=/home/timetracker
GIT_REPO_DIR=${DEPLOY_DIR}/time-tracker
set -ex

latest_jar () {
  ls -tr target/uberjar/*standalone.jar | tail -1
}
sudo systemctl stop timetracker.service

cd ${GIT_REPO_DIR}
sudo -H -u timetracker git fetch --tags
sudo -H -u timetracker git checkout ${RELEASE_TAG}
sudo -H -u timetracker ${DEPLOY_DIR}/lein uberjar
sudo -H -u timetracker cp ${GIT_REPO_DIR}.jar ${GIT_REPO_DIR}-$(date +%s).jar
sudo -H -u timetracker cp $(latest_jar) ${GIT_REPO_DIR}.jar

sudo systemctl start timetracker.service

Deploy a given release tag.
Deploy a given release tag.
