forked from operator-framework/operator-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
release.sh
executable file
·59 lines (46 loc) · 1.47 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
59
#!/usr/bin/env bash
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 ls-files --others --exclude-standard | grep -Ev 'build/operator-sdk-v.+'; then
echo "directory has untracked files"
exit 1
fi
if ! git diff-index --quiet HEAD --; then
echo "directory has uncommitted files"
exit 1
fi
GO_VER="1.13"
if ! go version | cut -d" " -f3 | grep -q "$GO_VER"; then
echo "must compile binaries with Go compiler version v${GO_VER}"
exit 1
fi
# Detect whether versions in code were updated.
VER_FILE="internal/version/version.go"
CURR_VER="$(sed -nr 's|\s+Version\s+= "(.+)"|\1|p' "$VER_FILE" | tr -d ' \t\n')"
if [[ "$VER" != "$CURR_VER" ]]; then
echo "version is not set correctly in $VER_FILE"
exit 1
fi
INSTALL_GUIDE_FILE="website/content/en/docs/installation/install-operator-sdk.md"
CURR_VER_INSTALL_GUIDE_FILE="$(sed -nr 's/.*RELEASE_VERSION=(.+)/\1/p' "$INSTALL_GUIDE_FILE" | tr -d ' \t\n')"
if [[ "$VER" != "$CURR_VER_INSTALL_GUIDE_FILE" ]]; then
echo "version '$VER' is not set correctly in $INSTALL_GUIDE_FILE"
exit 1
fi
# Tag the release commit and verify its tag.
git tag --sign --message "Operator SDK $VER" "$VER"
git verify-tag --verbose "$VER"
# Run the release builds.
make release V=1
# Verify the signatures
for f in $(ls build/*.asc); do gpg --verify $f; done