-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprepare_deploy.sh
executable file
·68 lines (49 loc) · 1.19 KB
/
prepare_deploy.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
68
#!/bin/bash
#
#
# Description : Prepare deploy vorimport package.
# Author : vassilux
#
set -e
VERSION=$(cat VERSION)
cp main.go main.go.bkp
sed -i "/VERSION = \"X.X.X\"/c\VERSION = \"${VERSION}\"" main.go
make clean
make fmt
make
if [ ! -f ./bin/vorimport ]; then
echo "Can not find compiled project file ./bin/vorimport."
echo "Please cheque make output."
exit 1
fi
mv main.go.bkp main.go
DEPLOY_DIR="vorimport_${VERSION}"
DEPLOY_FILE_NAME="vorimport_${VERSION}.tar.gz"
if [ -d "$DEPLOY_DIR" ]; then
rm -rf "$DEPLOY_DIR"
fi
#
#
mkdir "$DEPLOY_DIR"
cp -aR ./bin/* "$DEPLOY_DIR"
cp -aR ./samples/* "$DEPLOY_DIR"
#
mkdir "$DEPLOY_DIR/docs"
pandoc -o "$DEPLOY_DIR/docs/INSTALL.html" ./docs/INSTALL.md
pandoc -o "$DEPLOY_DIR/docs/ReleaseNotes.html" ./docs/ReleaseNotes.md
cp "$DEPLOY_DIR/docs/INSTALL.html" .
cp "$DEPLOY_DIR/docs/ReleaseNotes.html" .
tar cvzf "${DEPLOY_FILE_NAME}" "${DEPLOY_DIR}"
if [ ! -f "$DEPLOY_FILE_NAME" ]; then
echo "Deploy build failed."
exit 1
fi
if [ ! -d releases ]; then
mkdir releases
fi
mv ${DEPLOY_FILE_NAME} ./releases
mv INSTALL.* ./releases
mv ReleaseNotes.* ./releases
rm -rf "$DEPLOY_DIR"
echo "Deploy build complete."
echo "Live well."