Skip to content

Commit 0636ba1

Browse files
committed
add deploy script
1 parent 2fcd7c6 commit 0636ba1

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

deploy.sh

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/bin/bash -xe
2+
GIT_REV=`git log --pretty=format:'%h' -n 1`
3+
BUILD_DATE=`date +%Y-%m-%d:%H:%M:%S`
4+
COMPILEINFO="$GIT_REV+$BUILD_DATE"
5+
6+
VERSION=`cat main.go| grep "const AppVersion" |cut -f4 -d " " | tr -d '"'`
7+
8+
#Remember to set GOROOT accordingly with your installation
9+
10+
export GOPATH=$PWD
11+
12+
rm -rf distrib/
13+
14+
declare -a target_folders=("linux64" "linux32" "linuxarm" "osx" "windows")
15+
16+
mkdir distrib
17+
18+
for folder in "${target_folders[@]}"
19+
do
20+
mkdir -p distrib/$folder/bin/
21+
go build -o distrib/$folder/bin/arduinoOTA -ldflags "-X main.compileInfo=\"$COMPILEINFO\"" main.go
22+
23+
done
24+
25+
#Fix windows binary extension
26+
mv distrib/windows/bin/arduinoOTA distrib/windows/bin/arduinoOTA.exe
27+
28+
cd distrib
29+
30+
for folder in "${target_folders[@]}"
31+
do
32+
cd $folder
33+
if [[ $folder == "windows" ]]; then
34+
zip -r ../arduinoOTA-$VERSION-windows.zip bin/
35+
else
36+
tar cjf ../arduinoOTA-$VERSION-$folder.tar.bz2 bin/
37+
fi
38+
cd ..
39+
done
40+
41+
echo =======
42+
ls -la arduinoOTA*
43+
echo =======
44+
sha256sum arduinoOTA*
45+
echo =======
46+
shasum arduinoOTA*
47+

0 commit comments

Comments
 (0)