Added Bundle udpate script

This commit is contained in:
Trevor Vallender 2023-06-01 14:15:39 +01:00
parent 4d3bde3d9d
commit bd798bc35f
1 changed files with 39 additions and 0 deletions

39
bundle_update.sh Executable file
View File

@ -0,0 +1,39 @@
#!/usr/bin/env bash
# Best practice options
set -o nounset
set -o pipefail
if [[ "${TRACE-0}" == "1" ]]; then set -o xtrace; fi
if [[ "${1-}" =~ ^-*h(elp)?$ ]]; then
echo 'Usage:
'
exit
fi
declare -a UPDATE_LEVELS=(patch minor major)
dip test
if [ $? -ne 0 ]; then
echo "Tests failed prior to updating any gems. Exiting."
exit
fi
DATE=`date "+%F"`
git checkout -b "bundle_update_$DATE"
for level in "${UPDATE_LEVELS[@]}"; do
dip bundle update --$level
dip test
if [ $? -ne 0 ]; then
echo "Tests failed after $level update, rolling those changes back."
git restore .
break
else
echo "Tests passed after $level update, committing changes."
git add -A
git commit -m "Successful automatic $level update"
fi
done
git push -u origin $(git symbolic-ref --short HEAD) -o merge_request.create # Create remote branch