| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 | #!/bin/bashGREEN='\033[0;32m'RED='\033[0;31m'WHITE='\033[0;37m'RESET='\033[0m'function validateVersion(){    echo ""    passedVersion=$1    echo -e "${WHITE}-- Validating tag '$passedVersion'...${RESET}"    # Todo: validate the version here using a regex; if fail, just exit    #       ... expect 8.75.0, with no v in front of it    if [[ $passedVersion == '' ]]; then        echo -e "\n-- Invalid tag. Tags should be structured without v; e.g. 8.57.0"        exit    fi    echo -e "${WHITE}-- Tag valid.${RESET}"    echo ""}# Exit script if any command fails (e.g. phpunit)set -e# Require confirmation it's set up corrctlyecho echo -e "${WHITE}-- This script is meant to be run after running upgrade.sh, BEFORE committing to Git.${RESET}"while true; do    echo -e "${GREEN}-- Is that the current state of your local project?${RESET}"    read -p "-- (y/n) " yn    case $yn in        [Yy]* ) break;;        [Nn]* ) exit;;        * ) echo "Please answer y or n.";;    esacdone# Get the version and exit if not validvalidateVersion $1# Create official v prefaced versionversion="v$1"# Run tests (and bail if they fail)phpunitecho -e "\n${WHITE}-- Tests succeeded.${RESET}"# Branchecho -e "\n${WHITE}-- Creating a Git branch '$version-changes'...${RESET}\n"git checkout -b $version-changes# Add and commit, with "v8.57.0 changes" as the commit namegit add -Agit commit -m "$version changes"echo echo -e "${WHITE}-- Git committed.${RESET}"# Pushgit push -u origin $version-changes
 |