forked from smebberson/docker-alpine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tag
executable file
·67 lines (55 loc) · 1.2 KB
/
tag
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/usr/bin/env sh
# This is a simple and portable (POSIX) shell script
VERSION=""
IMAGE=""
COMMENT=""
# output information about how to use this script
usage()
{
echo ""
echo "Use this to tag this image to a specific version."
echo ""
echo "./tag -v [version] -c [\"Comment\"]"
echo ""
echo "\t-h --help"
echo "\t-i [image] The image to tag, i.e. alpine-base"
echo "\t-v [version] The version to append to the tag create '[alpine-base][-v][1.0.0]'"
echo "\t-c \"[comment]\" The comment to annotate the tag with"
echo ""
echo ""
}
if [ "$1" = "--help" ]; then
usage
exit
fi
while getopts "hi:v:c:" OPTION
do
case $OPTION in
h)
usage
exit
;;
i)
IMAGE=$OPTARG
;;
v)
VERSION=$OPTARG
;;
c)
COMMENT=$OPTARG
;;
?)
usage
exit 1
;;
esac
done
TAG="$IMAGE-v$VERSION"
if test "$IMAGE" != "" && test "$VERSION" != "" && test "$COMMENT" != ""; then
git tag -a "$TAG" -m \""$COMMENT"\"
git push --follow-tags
exit
fi
# if the version wasnt set, output the help
usage
exit 1;