-
Notifications
You must be signed in to change notification settings - Fork 6
/
make_release.sh
executable file
·39 lines (34 loc) · 993 Bytes
/
make_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
#!/bin/bash
set -e
set -x
REV=$(git rev-parse --short HEAD)
TAG=$(git describe --tags)
VERSION="${TAG} (${REV})"
GO_OSARCH="darwin/amd64 linux/386 linux/amd64 linux/arm windows/386 windows/amd64"
mkdir -p dist
for v in ${GO_OSARCH}; do
GOOS=$(echo ${v} | cut -d/ -f 1)
GOARCH=$(echo ${v} | cut -d/ -f 2)
GOOS=${GOOS} GOARCH=${GOARCH} go build -ldflags "-X \"main.appVersion=${VERSION}\""
exe=max7456tool
rel=max7456tool_${TAG}_${GOOS}_${GOARCH}
zip=${rel}.zip
tgz=${rel}.tar.gz
if [ ${GOOS} = "windows" ]; then
exe=${exe}.exe
zip ${zip} ${exe}
dist=${zip}
elif [ ${GOOS} = "darwin" ]; then
if ! [ -z ${CODESIGN} ]; then
macapptool sign ${exe}
macapptool notarize -u "${NOTARIZATION_USERNAME}" -p "${NOTARIZATION_PASSWORD}" ${exe}
fi
zip ${zip} ${exe}
dist=${zip}
else
tar czf ${tgz} ${exe}
dist=${tgz}
fi
mv ${dist} dist
done
go clean