added deploy script

This commit is contained in:
Bryan Joshua Pedini 2022-09-18 16:18:35 +02:00
parent e30e98ada6
commit 65643c00c5
1 changed files with 29 additions and 0 deletions

29
deploy.sh Executable file
View File

@ -0,0 +1,29 @@
#/usr/bin/env bash
set -e
# Check for the source server (with default)
DEPLOY_SOURCE_FILE="~/.deploy_source"
DEPLOY_SOURCE="git.bjphoster.com"
if [ -f "${DEPLOY_SOURCE_FILE}" ]; then
. "${DEPLOY_SOURCE_FILE}"
fi
# Check for the deploy position (with default)
DEPLOY_DESTINATION_FILE="~/.deploy_destination"
DEPLOY_DESTINATION="/opt"
if [ -f "${DEPLOY_SOURCE_FILE}" ]; then
. "${DEPLOY_SOURCE_FILE}"
fi
# Check if the correct usage is respected
if [ $# -ne 2 ]; then
echo "Usage: $0 <service> <service name>"
echo
echo "Current settings:"
echo "- Source · ${DEPLOY_SOURCE}"
echo "- Destination · ${DEPLOY_DESTINATION}"
exit
fi
echo "deploying ..."
git clone "${DEPLOY_SOURCE}/${1}" "${DEPLOY_DESTINATION}/$2"