Skip to content

Commit c530ede

Browse files
committedJan 4, 2016
Added untag to scripts/tag.sh.
[ci skip]
1 parent 0421dd3 commit c530ede

File tree

1 file changed

+54
-7
lines changed

1 file changed

+54
-7
lines changed
 

‎scripts/tag.sh

+54-7
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,60 @@ __dir__="$(cd "$(dirname "$0")" && pwd)"
55
# shellcheck source=scripts/configuration.sh
66
source "$__dir__/configuration.sh"
77

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

10-
let major=${array[0]}
11-
let minor=${array[1]}+1
11+
let major=${array[0]}
12+
let minor=${array[1]}+1
1213

13-
version="${major}.${minor}"
14-
message="\"Version $version ($(date +"%F"))\""
14+
version="${major}.${minor}"
15+
message="\"Version $version ($(date +"%F"))\""
1516

16-
echo Tagging "v$version" as "$message"
17-
git tag -a -m "$message" "v$version"
17+
echo Tagging "v$version" as "$message"
18+
git tag -a -m "$message" "v$version"
19+
}
20+
21+
function rbx_untag_release {
22+
local version untag_version
23+
24+
version=$1
25+
26+
IFS="." read -r -a array <<< "$(rbx_revision_version)"
27+
28+
let major=${array[0]}
29+
let minor=${array[1]}
30+
31+
untag_version="${major}.${minor}"
32+
33+
git describe "$untag_version" > /dev/null
34+
35+
if [[ $? -eq 0 && "$version" == "$untag_version" ]]; then
36+
echo Untagging "v$version"
37+
# git tag -d "v$version" && git push origin ":refs/tags/v$version"
38+
else
39+
echo NOT untagging "v$version", does not match "v$untag_version"
40+
fi
41+
}
42+
43+
function rbx_tag_usage {
44+
echo "Usage: ${0##*/} [tag untag]"
45+
exit 1
46+
}
47+
48+
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
49+
if [[ -z $1 ]]; then
50+
rbx_tag_usage
51+
fi
52+
53+
case "$1" in
54+
"tag")
55+
rbx_tag_release
56+
;;
57+
"untag")
58+
rbx_untag_release "$2"
59+
;;
60+
"-h"|"--help"|*)
61+
rbx_tag_usage
62+
;;
63+
esac
64+
fi

0 commit comments

Comments
 (0)
Please sign in to comment.