Loading GitflowAndVersioning.md +5 −1 Original line number Original line Diff line number Diff line Loading @@ -129,3 +129,7 @@ named as major.minor.patch. For proper versioning, one MUST use the features have been merged into dev branch and are ready to be released features have been merged into dev branch and are ready to be released in production. After merging into the master, `tag-version.sh` MUST be in production. After merging into the master, `tag-version.sh` MUST be used to tag the release version at the latest commit. used to tag the release version at the latest commit. > Notes - `bump-version.sh` will and must execute only on **dev** and > **hotfix\*** branches while `tag-version.sh` will and must only work > on **master** branch. No newline at end of file bump-version.sh +85 −73 Original line number Original line Diff line number Diff line #!/bin/bash #!/bin/bash git diff-index --quiet HEAD -- #if [ $? -ne 0 ]; then #if [ $? -ne 0 ]; then #echo "Working tree must be empty before bumping the version" #echo "Working tree must be empty before bumping the version" Loading @@ -16,6 +15,7 @@ NOCOLOR="\033[0m" QUESTION_FLAG="${GREEN}?" QUESTION_FLAG="${GREEN}?" NOTICE_FLAG="${CYAN}❯" NOTICE_FLAG="${CYAN}❯" ERROR_FLAG="${RED}🛑🛑\U25CF" BUMPING_MSG="${NOTICE_FLAG} Bumping up version...${NOCOLOR}" BUMPING_MSG="${NOTICE_FLAG} Bumping up version...${NOCOLOR}" PUSHING_MSG="${NOTICE_FLAG} Pushing new version to the ${WHITE}origin${CYAN}...${NOCOLOR}" PUSHING_MSG="${NOTICE_FLAG} Pushing new version to the ${WHITE}origin${CYAN}...${NOCOLOR}" Loading Loading @@ -66,6 +66,7 @@ else fi fi } } do_version_upgrade() { VERSION_UPGRADE_TYPE=$1 VERSION_UPGRADE_TYPE=$1 old_major=$((`cat app/build.gradle | grep "versionMajor = " | awk '{print $4}'`)) old_major=$((`cat app/build.gradle | grep "versionMajor = " | awk '{print $4}'`)) Loading @@ -81,6 +82,7 @@ if [[ "${VERSION_UPGRADE_TYPE,,}" = "major" ]]; then echo -e "${NOTICE_FLAG} Will set new version to ${GREEN}${new_version}${NOCOLOR}." echo -e "${NOTICE_FLAG} Will set new version to ${GREEN}${new_version}${NOCOLOR}." echo -ne "${QUESTION_FLAG} ${RED}Are you sure? [Y/n]: ${NOCOLOR}" echo -ne "${QUESTION_FLAG} ${RED}Are you sure? [Y/n]: ${NOCOLOR}" read response response=${response,,} response=${response,,} if [[ ${response} =~ ^(yes|y| ) ]] || [[ -z ${response} ]]; then if [[ ${response} =~ ^(yes|y| ) ]] || [[ -z ${response} ]]; then Loading Loading @@ -138,3 +140,13 @@ else echo " Wrong or empty arguments passed for <revision_type>. See usage below." echo " Wrong or empty arguments passed for <revision_type>. See usage below." usage usage fi fi } # It must check for dev or hotfix* branch and bump the version only when current branch is dev or hotfix. branch=$(git branch | sed -n -e 's/^\* \(.*\)/\1/p') if [[ ${branch} = "dev" ]] || [[ ${branch} = hotfix* ]]; then do_version_upgrade $1 else echo -e "${ERROR_FLAG} Can only be used on dev or hotfix branch." exit 1 fi tag-version.sh +3 −1 Original line number Original line Diff line number Diff line #!/bin/bash #!/bin/bash # It must check for master branch and tag only if current branch is master. branch=$(git branch | sed -n -e 's/^\* \(.*\)/\1/p') branch=$(git branch | sed -n -e 's/^\* \(.*\)/\1/p') response=${response,,} if [[ ${branch} = "master" ]]; then if [[ ${branch} = "master" ]]; then major=$((`cat app/build.gradle | grep "versionMajor = " | awk '{print $4}'`)) major=$((`cat app/build.gradle | grep "versionMajor = " | awk '{print $4}'`)) minor=$((`cat app/build.gradle | grep "versionMinor = " | awk '{print $4}'`)) minor=$((`cat app/build.gradle | grep "versionMinor = " | awk '{print $4}'`)) Loading Loading
GitflowAndVersioning.md +5 −1 Original line number Original line Diff line number Diff line Loading @@ -129,3 +129,7 @@ named as major.minor.patch. For proper versioning, one MUST use the features have been merged into dev branch and are ready to be released features have been merged into dev branch and are ready to be released in production. After merging into the master, `tag-version.sh` MUST be in production. After merging into the master, `tag-version.sh` MUST be used to tag the release version at the latest commit. used to tag the release version at the latest commit. > Notes - `bump-version.sh` will and must execute only on **dev** and > **hotfix\*** branches while `tag-version.sh` will and must only work > on **master** branch. No newline at end of file
bump-version.sh +85 −73 Original line number Original line Diff line number Diff line #!/bin/bash #!/bin/bash git diff-index --quiet HEAD -- #if [ $? -ne 0 ]; then #if [ $? -ne 0 ]; then #echo "Working tree must be empty before bumping the version" #echo "Working tree must be empty before bumping the version" Loading @@ -16,6 +15,7 @@ NOCOLOR="\033[0m" QUESTION_FLAG="${GREEN}?" QUESTION_FLAG="${GREEN}?" NOTICE_FLAG="${CYAN}❯" NOTICE_FLAG="${CYAN}❯" ERROR_FLAG="${RED}🛑🛑\U25CF" BUMPING_MSG="${NOTICE_FLAG} Bumping up version...${NOCOLOR}" BUMPING_MSG="${NOTICE_FLAG} Bumping up version...${NOCOLOR}" PUSHING_MSG="${NOTICE_FLAG} Pushing new version to the ${WHITE}origin${CYAN}...${NOCOLOR}" PUSHING_MSG="${NOTICE_FLAG} Pushing new version to the ${WHITE}origin${CYAN}...${NOCOLOR}" Loading Loading @@ -66,6 +66,7 @@ else fi fi } } do_version_upgrade() { VERSION_UPGRADE_TYPE=$1 VERSION_UPGRADE_TYPE=$1 old_major=$((`cat app/build.gradle | grep "versionMajor = " | awk '{print $4}'`)) old_major=$((`cat app/build.gradle | grep "versionMajor = " | awk '{print $4}'`)) Loading @@ -81,6 +82,7 @@ if [[ "${VERSION_UPGRADE_TYPE,,}" = "major" ]]; then echo -e "${NOTICE_FLAG} Will set new version to ${GREEN}${new_version}${NOCOLOR}." echo -e "${NOTICE_FLAG} Will set new version to ${GREEN}${new_version}${NOCOLOR}." echo -ne "${QUESTION_FLAG} ${RED}Are you sure? [Y/n]: ${NOCOLOR}" echo -ne "${QUESTION_FLAG} ${RED}Are you sure? [Y/n]: ${NOCOLOR}" read response response=${response,,} response=${response,,} if [[ ${response} =~ ^(yes|y| ) ]] || [[ -z ${response} ]]; then if [[ ${response} =~ ^(yes|y| ) ]] || [[ -z ${response} ]]; then Loading Loading @@ -138,3 +140,13 @@ else echo " Wrong or empty arguments passed for <revision_type>. See usage below." echo " Wrong or empty arguments passed for <revision_type>. See usage below." usage usage fi fi } # It must check for dev or hotfix* branch and bump the version only when current branch is dev or hotfix. branch=$(git branch | sed -n -e 's/^\* \(.*\)/\1/p') if [[ ${branch} = "dev" ]] || [[ ${branch} = hotfix* ]]; then do_version_upgrade $1 else echo -e "${ERROR_FLAG} Can only be used on dev or hotfix branch." exit 1 fi
tag-version.sh +3 −1 Original line number Original line Diff line number Diff line #!/bin/bash #!/bin/bash # It must check for master branch and tag only if current branch is master. branch=$(git branch | sed -n -e 's/^\* \(.*\)/\1/p') branch=$(git branch | sed -n -e 's/^\* \(.*\)/\1/p') response=${response,,} if [[ ${branch} = "master" ]]; then if [[ ${branch} = "master" ]]; then major=$((`cat app/build.gradle | grep "versionMajor = " | awk '{print $4}'`)) major=$((`cat app/build.gradle | grep "versionMajor = " | awk '{print $4}'`)) minor=$((`cat app/build.gradle | grep "versionMinor = " | awk '{print $4}'`)) minor=$((`cat app/build.gradle | grep "versionMinor = " | awk '{print $4}'`)) Loading