From 0d7266ce35298ea4731ddc9337692e36e8ad8b14 Mon Sep 17 00:00:00 2001 From: Bryan Joshua Pedini Date: Mon, 19 Sep 2022 12:05:38 +0200 Subject: [PATCH] added optional branch/tag checkout feature --- deploy.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/deploy.sh b/deploy.sh index 41f491d..b6a22a6 100755 --- a/deploy.sh +++ b/deploy.sh @@ -16,8 +16,8 @@ if [ -f "${DEPLOY_DESTINATION_FILE}" ]; then fi # Check if the correct usage is respected -if [ $# -ne 2 ]; then - echo "Usage: $0 " +if [ $# -le 2 ]; then + echo "Usage: $0 [branch/tag]" echo echo "Current settings:" echo "- Source ยท ${DEPLOY_SOURCE}" @@ -27,3 +27,9 @@ fi echo "deploying ..." git clone "${DEPLOY_SOURCE}/${1}" "${DEPLOY_DESTINATION}/${2}" + +if [ $# -eq 3 ]; then + pushd "${DEPLOY_DESTINATION}/${2}" + git checkout "${3}" + popd +fi