-
Notifications
You must be signed in to change notification settings - Fork 0
/
release.sh
executable file
·49 lines (37 loc) · 1.02 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
#!/bin/bash
set -e -u -o pipefail
cd $(dirname $0)
if git status -s | grep -q .; then
echo "dirty repo, run git status"
exit 2
fi
CURRENT="$(cat VERSION)"
if [[ "$#" > 0 ]]; then
VERSION="$1"
else
echo "Current version: $CURRENT"
read -p "Enter new version: " VERSION
fi
if [ "$VERSION" == "$CURRENT" ]; then
echo "input version is the same as current"
exit 2
fi
VERSION_REGEX='^v[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*(-[a-zA-Z0-9]*)?$'
if ! echo $VERSION | grep -q -E "$VERSION_REGEX"; then
echo "invalid version string $VERSION"
exit 2
fi
echo "Changing version from $CURRENT to $VERSION"
echo "The next steps will build the project and push data to both docker and github"
read -p "Continue? [y/n]: " CONTINUE
if [ "$CONTINUE" != "y" ]; then
echo "user aborted"
exit 2
fi
echo -n $VERSION > VERSION
docker buildx build --push --platform linux/arm64,linux/amd64 --tag bcap/redis-tools:$VERSION .
git add VERSION
git commit -m "Release $VERSION"
git tag $VERSION
git push
git push --tags