Added support for tagging during docker-versions-create.sh

This commit is contained in:
Geoff Bourne 2020-06-19 11:31:41 -05:00
parent f5dde77efe
commit f93c42a23f

View File

@ -10,12 +10,28 @@ function TrapExit {
batchMode=false
while getopts "b" arg
while getopts "hbt:" arg
do
case $arg in
b)
batchMode=true
;;
t)
tag=${OPTARG}
;;
h)
echo "
Usage $0 [options]
Options:
-b enable batch mode, which avoids interactive prompts and causes script to fail immediately
when any merge fails
-t TAG tag and push the current revision on master with the given tag
and apply respective tags to each branch
-h display this help and exit
"
exit
;;
*)
echo "Unsupported arg $arg"
exit 2
@ -34,6 +50,10 @@ test -d ./.git || { echo ".git folder was not found. Please start this script fr
git checkout master
git pull --all || { echo "Can't pull the repo!"; \
exit 1; }
if [[ $tag ]]; then
git tag $tag
git push origin $tag
fi
git_branches=$(git branch -a)
@ -57,6 +77,10 @@ for branch in "${branches_list[@]}"; do
git commit -m "Auto merge branch with master" -a
# push may fail if remote doesn't have this branch yet. In this case - sending branch
git push || git push -u origin "$branch" || { echo "Can't push changes to the origin."; exit 1; }
if [[ $tag ]]; then
git tag "$tag-$branch"
git push origin "$tag-$branch"
fi
elif ${batchMode}; then
status=$?
echo "Git merge failed in batch mode"