forked from grafana/grafana
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtag_release.sh
executable file
·41 lines (31 loc) · 888 Bytes
/
tag_release.sh
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
#!/usr/bin/env bash
# abort if we get any error
set -e
_tag=$1
_branch="$(git rev-parse --abbrev-ref HEAD)"
if [ "${_tag}" == "" ]; then
echo "Missing version param. ex './scripts/tag_release.sh v5.1.1'"
exit 1
fi
if [ "${_branch}" == "main" ]; then
echo "you cannot tag releases from the main branch"
echo "please checkout the release branch"
echo "ex 'git checkout v5.1.x'"
exit 1
fi
# always make sure to pull latest changes from origin
echo "pulling latest changes from ${_branch}"
git pull origin "${_branch}"
# create signed tag for latest commit
git tag -s "${_tag}" -m "release ${_tag}"
# verify the signed tag
git tag -v "${_tag}"
echo "Make sure the tag is signed as expected"
echo "press [y] to push the tags"
read -n 1 confirm
if [ "${confirm}" == "y" ]; then
git push origin "${_tag}"
else
git tag -d "${_tag}"
echo "Abort! "
fi