diff --git a/cd.sh b/cd.sh index 4051d08..6afc7c5 100644 --- a/cd.sh +++ b/cd.sh @@ -27,6 +27,15 @@ case "${CD_OS_NAME}" in exit 1 ;; esac +# project / branch +[ "${CI_COMMIT_BRANCH}" ] && CD_PROJECT_BRANCH="${CI_COMMIT_BRANCH}" +[ "${GITHUB_REF_NAME}" ] && CD_PROJECT_BRANCH="${GITHUB_REF_NAME}" +if [ "${CD_PROJECT_BRANCH}" ] ; then + echo "CD_PROJECT_BRANCH = ${CD_PROJECT_BRANCH}" +else + echo 'CD_PROJECT_BRANCH' + exit 3 +fi # project / name [ "${CI_PROJECT_PATH}" ] \ && CD_PROJECT_NAME="$(basename "${CI_PROJECT_PATH}")" @@ -60,15 +69,6 @@ else echo 'CD_REPOSITORIES_URL' exit 3 fi -# -[ "${CI_COMMIT_BRANCH}" ] && CD_PROJECT_BRANCH="${CI_COMMIT_BRANCH}" -[ "${GITHUB_REF_NAME}" ] && CD_PROJECT_BRANCH="${GITHUB_REF_NAME}" -if [ "${CD_PROJECT_BRANCH}" ] ; then - echo "CD_PROJECT_BRANCH = ${CD_PROJECT_BRANCH}" -else - echo 'CD_PROJECT_BRANCH' - exit 3 -fi function cd_step { if [ "${1}" ] ; then