-
Notifications
You must be signed in to change notification settings - Fork 42
/
release.sh
executable file
·58 lines (49 loc) · 1.66 KB
/
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/bash
###############################################################################################
### RELEASING OPERATOR-LIB
# Every operator-lib release should have a corresponding git semantic version tag
# begining with `v`, ex.n `v1.2.3`.
#
# STEP 1: Create a release branch with the name vX.Y.x. Example: git checkout -b v1.2.x
#
# STEP 2: Run the release script by providing the operator-lib release version as an argument
# in the above mentioned format. Example: ./release vX.Y.Z
#
# STEP 3: This script will create a release tag locally. Push the release branch and tag:
# git push upstream <release-branch>
# git push upstream <tag-name>, wherein <tag-name> is the release version.
#
# STEP 4: Update the release notes in github with the changes included in corresponding
# operator-lib version.
#################################################################################################
set -eu
if [[ $# != 1 ]]; then
echo "usage: $0 vX.Y.Z"
exit 1
fi
VER=$1
NUMRE="0|[1-9][0-9]*"
PRERE="\-(alpha|beta|rc)\.[1-9][0-9]*"
if ! [[ "$VER" =~ ^v($NUMRE)\.($NUMRE)\.($NUMRE)($PRERE)?$ ]]; then
echo "malformed version: \"$VER\""
exit 1
fi
if ! git diff-index --quiet HEAD --; then
echo "directory has uncommitted files"
exit 1
fi
# Run tests
echo "Running tests"
make check
# Tag the release commit and verify its tag
echo "Creating a new tag for Operator-lib version $VER"
git tag --sign --message "operator-lib $VER" "$VER"
git verify-tag --verbose $VER
# Add reminder on next stpes
echo ""
echo "Done forget to:"
echo ""
echo "git push upstream <release-branch>"
echo "git push upstream $VER"
echo ""
echo "Also update the release notes in github for this tag."