Skip to content
Permalink
Browse files
Added untag to scripts/tag.sh.
[ci skip]
  • Loading branch information
brixen committed Jan 4, 2016
1 parent 0421dd3 commit c530edef74a2b28cb92f0ff607d9b008689f5482
Showing with 54 additions and 7 deletions.
  1. +54 −7 scripts/tag.sh
@@ -5,13 +5,60 @@ __dir__="$(cd "$(dirname "$0")" && pwd)"
# shellcheck source=scripts/configuration.sh
source "$__dir__/configuration.sh"

IFS="." read -r -a array <<< "$(rbx_revision_version)"
function rbx_tag_release {
IFS="." read -r -a array <<< "$(rbx_revision_version)"

let major=${array[0]}
let minor=${array[1]}+1
let major=${array[0]}
let minor=${array[1]}+1

version="${major}.${minor}"
message="\"Version $version ($(date +"%F"))\""
version="${major}.${minor}"
message="\"Version $version ($(date +"%F"))\""

echo Tagging "v$version" as "$message"
git tag -a -m "$message" "v$version"
echo Tagging "v$version" as "$message"
git tag -a -m "$message" "v$version"
}

function rbx_untag_release {
local version untag_version

version=$1

IFS="." read -r -a array <<< "$(rbx_revision_version)"

let major=${array[0]}
let minor=${array[1]}

untag_version="${major}.${minor}"

git describe "$untag_version" > /dev/null

if [[ $? -eq 0 && "$version" == "$untag_version" ]]; then
echo Untagging "v$version"
# git tag -d "v$version" && git push origin ":refs/tags/v$version"
else
echo NOT untagging "v$version", does not match "v$untag_version"
fi
}

function rbx_tag_usage {
echo "Usage: ${0##*/} [tag untag]"
exit 1
}

if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
if [[ -z $1 ]]; then
rbx_tag_usage
fi

case "$1" in
"tag")
rbx_tag_release
;;
"untag")
rbx_untag_release "$2"
;;
"-h"|"--help"|*)
rbx_tag_usage
;;
esac
fi

0 comments on commit c530ede

Please sign in to comment.