forked from operator-framework/operator-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrelease.sh
executable file
·42 lines (32 loc) · 1.07 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
#!/usr/bin/env bash
set -e
[ $# == 1 ] || { echo "usage: $0 version" && exit 1; }
VER=$1
[[ "$VER" =~ ^v[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+$ ]] || {
echo "malformed version: \"$VER\""
exit 2
}
if test -n "$(git ls-files --others | \
grep --invert-match '\(vendor\|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
# Detect whether versions in code were updated.
CURR_VER="$(git describe --dirty --tags)"
VER_FILE="version/version.go"
TOML_TMPL_FILE="pkg/generator/templates.go"
CURR_VER_VER_FILE="$(sed -nr 's/Version = "(.+)"/\1/p' "$VER_FILE" | tr -d '\s\t\n')"
CURR_VER_TMPL_FILE="$(sed -nr 's/.*".*v(.+)".*#osdk_version_annotation/v\1/p' "$TOML_TMPL_FILE" | tr -d '\s\t\n')"
if [ "$VER" != "$CURR_VER_VER_FILE" ] \
|| [ "$VER" != "$CURR_VER_TMPL_FILE" ]; then
echo "versions are not set correctly in $VER_FILE or $TOML_TMPL_FILE"
exit 1
fi
git tag --sign --message "Operator SDK $VER" "$VER"
git verify-tag --verbose "$VER"
make release