You've already forked docker-deploy
Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
ce7e2593f4 | |||
0d7266ce35 | |||
ea0bea3c94 | |||
1078366ff5 |
20
deploy.sh
20
deploy.sh
@@ -2,22 +2,22 @@
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
# Check for the source server (with default)
|
# Check for the source server (with default)
|
||||||
DEPLOY_SOURCE_FILE="~/.deploy_source"
|
DEPLOY_SOURCE_FILE="${HOME}/.deploy_source"
|
||||||
DEPLOY_SOURCE="https://git.bjphoster.com/deployments"
|
DEPLOY_SOURCE="https://git.bjphoster.com/deployments"
|
||||||
if [ -f "${DEPLOY_SOURCE_FILE}" ]; then
|
if [ -f "${DEPLOY_SOURCE_FILE}" ]; then
|
||||||
. "${DEPLOY_SOURCE_FILE}"
|
. "${DEPLOY_SOURCE_FILE}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check for the deploy position (with default)
|
# Check for the deploy position (with default)
|
||||||
DEPLOY_DESTINATION_FILE="~/.deploy_destination"
|
DEPLOY_DESTINATION_FILE="${HOME}/.deploy_destination"
|
||||||
DEPLOY_DESTINATION="/opt"
|
DEPLOY_DESTINATION="/opt"
|
||||||
if [ -f "${DEPLOY_SOURCE_FILE}" ]; then
|
if [ -f "${DEPLOY_DESTINATION_FILE}" ]; then
|
||||||
. "${DEPLOY_SOURCE_FILE}"
|
. "${DEPLOY_DESTINATION_FILE}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check if the correct usage is respected
|
# Check if the correct usage is respected
|
||||||
if [ $# -ne 2 ]; then
|
if [ $# -lt 2 ]; then
|
||||||
echo "Usage: $0 <service> <service name>"
|
echo "Usage: $0 <service> <service name> [branch/tag]"
|
||||||
echo
|
echo
|
||||||
echo "Current settings:"
|
echo "Current settings:"
|
||||||
echo "- Source · ${DEPLOY_SOURCE}"
|
echo "- Source · ${DEPLOY_SOURCE}"
|
||||||
@@ -26,4 +26,10 @@ if [ $# -ne 2 ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo "deploying ..."
|
echo "deploying ..."
|
||||||
git clone "${DEPLOY_SOURCE}/${1}" "${DEPLOY_DESTINATION}/$2"
|
git clone "${DEPLOY_SOURCE}/${1}" "${DEPLOY_DESTINATION}/${2}"
|
||||||
|
|
||||||
|
if [ $# -eq 3 ]; then
|
||||||
|
pushd "${DEPLOY_DESTINATION}/${2}"
|
||||||
|
git checkout "${3}"
|
||||||
|
popd
|
||||||
|
fi
|
||||||
|
Reference in New Issue
Block a user