forked from hootsuite/atlantis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbinary-release.sh
executable file
·44 lines (37 loc) · 955 Bytes
/
binary-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
#!/bin/bash
# define architecture we want to build
XC_ARCH=${XC_ARCH:-"386 amd64 arm"}
XC_OS=${XC_OS:-linux darwin}
XC_EXCLUDE_OSARCH="!darwin/arm !darwin/386"
# clean up
echo "-> running clean up...."
rm -rf output/*
if ! which gox > /dev/null; then
echo "-> installing gox..."
go get -u github.com/mitchellh/gox
fi
# build
# we want to build statically linked binaries
export CGO_ENABLED=0
echo "-> building..."
gox \
-os="${XC_OS}" \
-arch="${XC_ARCH}" \
-osarch="${XC_EXCLUDE_OSARCH}" \
-output "output/{{.OS}}_{{.Arch}}/atlantis" \
.
# Zip and copy to the dist dir
echo ""
echo "Packaging..."
for PLATFORM in $(find ./output -mindepth 1 -maxdepth 1 -type d); do
OSARCH=$(basename ${PLATFORM})
echo "--> ${OSARCH}"
pushd $PLATFORM >/dev/null 2>&1
zip ../atlantis_${OSARCH}.zip ./*
popd >/dev/null 2>&1
done
echo ""
echo ""
echo "-----------------------------------"
echo "Output:"
ls -alh output/