forked from tair-opensource/RedisShake
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·43 lines (36 loc) · 991 Bytes
/
build.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
#!/bin/bash
set -e
echo "[ BUILD RELEASE ]"
BIN_DIR=$(pwd)/bin/
rm -rf "$BIN_DIR"
mkdir -p "$BIN_DIR"
cp sync.toml "$BIN_DIR"
cp scan.toml "$BIN_DIR"
cp restore.toml "$BIN_DIR"
cp -r filters "$BIN_DIR"
cp -r scripts/cluster_helper "$BIN_DIR"
dist() {
echo "try build GOOS=$1 GOARCH=$2"
export GOOS=$g
export GOARCH=$a
export CGO_ENABLED=0
go build -v -trimpath -o "$BIN_DIR/redis-shake" "./cmd/redis-shake"
unset GOOS
unset GOARCH
echo "build success GOOS=$1 GOARCH=$2"
cd "$BIN_DIR"
tar -czvf ./redis-shake-"$1"-"$2".tar.gz ./sync.toml ./scan.toml ./restore.toml ./redis-shake ./filters ./cluster_helper
cd ..
}
if [ "$1" == "dist" ]; then
echo "[ DIST ]"
for g in "linux" "darwin"; do
for a in "amd64" "arm64"; do
dist "$g" "$a"
done
done
fi
# build the current platform
echo "try build for current platform"
go build -v -trimpath -o "$BIN_DIR/redis-shake" "./cmd/redis-shake"
echo "build success"