-
Notifications
You must be signed in to change notification settings - Fork 13
/
release.sh
executable file
·139 lines (110 loc) · 3.46 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#!/bin/bash
VERSION=$(cat ./VERSION)
if [[ -z $VERSION ]];
then
echo 'Put version in VERSION file'
exit 1
fi
# Include version info
echo $VERSION > ./src/main/resources/current-version.txt
unameOut="$(uname -s)"
case "${unameOut}" in
Linux*) machine=Linux;;
Darwin*) machine=Mac;;
CYGWIN*) machine=Cygwin;;
MINGW*) machine=MinGw;;
*) machine="UNKNOWN:${unameOut}"
esac
if [ "$machine" = "Mac" ]
then
sed -i '' "s/X.Y.Z/$VERSION/" pom.xml
else
sed -i "s/X.Y.Z/$VERSION/" pom.xml
fi
# Build
./build.sh
exit=$?
if [ $exit -ne 0 ]; then
echo 'Build failure'
exit 1
fi
# Check binary after build
BINARY=./target/99bot-$VERSION-jar-with-dependencies.jar
if [ ! -f $BINARY ];
then
echo 'Binary version '$VERSION' does not exist'
echo 'File not found: '$BINARY
exit 1
fi
# Cleanup
rm -rf ./release/
# Remake release directory
mkdir -p ./release/
# Copy binary
cp $BINARY ./release/BitHeroes.jar
# Provide empty properties file, help players override configuration
touch ./release/user-config.properties
cat <<EOF > ./release/user-config.properties
# Screen offset
# from left
#offset.screen.x=0
# from top
#offset.screen.y=57
# Game tokens
#1.game.kong.user.id=
#1.game.kong.user.name=
#1.game.auth.token=
# Configure telegram
#telegram.token=
#telegram.channel-id=
#telegram.instance-id=
# Tolerant
#tolerant.position=40
#tolerant.color=0
# Alter interval between loops of checking images, if you believe your PC is fast, you can use this key for a faster progression. Default interval for most functions is 5 seconds (please see at --help of each function), accepted format is: "number" = number of seconds / "number" + "s" = number of seconds / "number" + "ms" = number of milliseconds, eg: 50ms = loop every 50 milliseconds, or 5000ms equals to 5 seconds
#interval.loop.main=1s
# Normally, when someone send you a message (DM), bot got confused by the chat box and can not do anything, then you will be disconnected after amount if time
# by setting the following flag to "true", bot will take and save a screenshot into folder 'out\chatbox', close the chat box then continue it's work
#behavior.close-chat-box-direct-message=true
# Google Chrome path, for Windows only
#external.application.chrome.path=C:\\\\Program Files (x86)\\\\Google\\\\Chrome\\\\Application\\\\chrome.exe
# Google Chrome user dir, specify an external directory help you dont need to move the 'chrome-user-dir' folder next time when you update this Bit Heroes bot
#external.mini-client.user.dir=D:\\\\Data\\\\chrome-user-dir
# Disable sub-features
#disable.jansi=true
#disable.auto-update=true
EOF
# Copy files for mini client
cp ./prepare-mini-chrome-client.txt ./release/
# Copy sample scripts
mkdir ./release/sample-scripts/
cp ./sample-scripts/*.bat ./release/sample-scripts/
# Copy launch scripts for Linux
cp ./bot.sh ./release/
cp ./client.sh ./release/
cp ./help.sh ./release/
cp ./setting.sh ./release/
# Copy launch scripts for Windows
cp ./_.bat ./release/
cp ./web.bot.bat ./release/
cp ./steam.bot.bat ./release/
cp ./client.bat ./release/
cp ./help.bat ./release/
cp ./setting.bat ./release/
cp ./AFK.steam.bat ./release/
cp ./AFK.web.bat ./release/
# Remove secret
rm -f ./release/bh-client/*.html
rm -f ./release/readonly.*.properties
# Compress output
FILE=download-this-file.zip
rm -f $FILE
DIR=./99bot-v$VERSION
rm -rf $DIR
mv ./release $DIR
zip -r $FILE $DIR
rm -f ./latest.README.md
cp README.md ./latest.README.md
echo 'clean up'
rm -rf $DIR
echo 'Done '$FILE