Skip to content

Commit

Permalink
Added untag to scripts/tag.sh.
Browse files Browse the repository at this point in the history
[ci skip]
  • Loading branch information
brixen committed Jan 4, 2016
1 parent 0421dd3 commit c530ede
Showing 1 changed file with 54 additions and 7 deletions.
61 changes: 54 additions & 7 deletions scripts/tag.sh
Expand Up @@ -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.