-
Notifications
You must be signed in to change notification settings - Fork 228
/
release.sh
executable file
·67 lines (53 loc) · 1.63 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
60
61
62
63
64
65
66
67
#!/bin/sh
# Simple script to do a release
TARGET_REMOTE=upstream
TARGET_VERSION="$1"
set -eu
set -o pipefail
if test "${TARGET_VERSION}" = ""; then
echo "USAGE: $0 <version>" >&2
exit 1
fi
TARGET_TAG="v${TARGET_VERSION}"
if ! echo "${TARGET_VERSION}" | egrep -q '^[0-9]+\.[0-9]+\.[0-9]+$'; then
echo "Error: Target version '${TARGET_VERSION}' is not well-formed. Must be X.Y.Z" >&2
exit 1
fi
echo "*** checking for current git branch"
RELEASE_BRANCH=$(git rev-parse --abbrev-ref HEAD || true)
if [[ $RELEASE_BRANCH = release-* ]]; then
echo "*** branch is $RELEASE_BRANCH"
IMAGE_TAG=${TARGET_TAG}
else
echo "Error: Branch $RELEASE_BRANCH is not release branch" >&2
exit 1
fi
if ! test -f VERSION; then
echo "Error: You should be in repository root." >&2
exit 1
fi
echo "${TARGET_VERSION}" > VERSION
echo "*** checking for existance of git tag ${TARGET_TAG}"
if git tag -l "${TARGET_VERSION}" | grep -q "${TARGET_TAG}"; then
echo "Error: Tag with version ${TARGET_TAG} already exists." >&2
exit 1
fi
echo "*** generating new manifests"
export IMAGE_TAG="${TARGET_TAG}"
make manifests
echo "*** performing release commit"
git commit -S -s -m "Release ${TARGET_TAG}" VERSION manifests/
git tag ${TARGET_TAG}
echo "*** build multiarch docker image"
make multiarch-image
echo "*** build multiarch release binaries"
make release-binaries
echo
echo "*** done"
echo
echo "If everything is fine, push changes to GitHub and Docker Hub:"
echo
echo " git push ${TARGET_REMOTE} $RELEASE_BRANCH ${TARGET_TAG}"
echo " make IMAGE_TAG='${TARGET_TAG}' multiarch-image-push"
echo
echo "Then, create release tag and execute upload-multiarch-release-assets.sh"