1
1
#! /bin/bash -eux
2
2
3
- export GOARCH=amd64
4
3
export buildArch=" -X main.buildArch"
5
4
5
+ arms=(7)
6
6
systems=(darwin freebsd linux windows)
7
7
8
- # Compile binaries for the desired operating systems
9
- for goos in ${systems[@]} ; do
10
- mkdir -p target/notable-${TAG} .${goos} -amd64
11
- cp LICENSE target/notable-${TAG} .${goos} -amd64
12
- GOOS=$goos CGO_ENABLED=$CGO_ENABLED go build \
13
- -ldflags " $FLAGS $buildArch =${goos} -${GOARCH} " \
14
- -o target/notable-${TAG} .${goos} -amd64/notable
8
+ function build () {
9
+ arch=$1
10
+ goos=$2
11
+ label=$3
12
+
13
+ mkdir -p target/notable-${TAG} .${goos} -${label}
14
+ cp LICENSE target/notable-${TAG} .${goos} -${label}
15
+ GOARCH=$arch GOOS=$goos CGO_ENABLED=$CGO_ENABLED go build \
16
+ -ldflags " $FLAGS $buildArch =${goos} -${label} " \
17
+ -o target/notable-${TAG} .${goos} -${label} /notable
15
18
if [ " $goos " == " windows" ]; then
16
- mv target/notable-${TAG} .${goos} -amd64 /{notable,notable.exe}
19
+ mv target/notable-${TAG} .${goos} -${label} /{notable,notable.exe}
17
20
fi
21
+ }
22
+
23
+ # Compile for amd64
24
+ for goos in ${systems[@]} ; do
25
+ build amd64 $goos amd64
26
+ done
27
+
28
+ # Compile for arm
29
+ for v in ${arms[@]} ; do
30
+ GOARM=$v build arm linux arm${v}
18
31
done
19
32
20
33
# Macos: create a macos app bundle
@@ -24,9 +37,16 @@ cp target/notable-${TAG}.darwin-amd64/notable \
24
37
25
38
# Package up the Github release zip files
26
39
pushd target
40
+
41
+ # Zip amd64
27
42
for goos in ${systems[@]} ; do
28
43
zip -r notable-${TAG} .${goos} -amd64.zip notable-${TAG} .${goos} -amd64
29
44
done
45
+
46
+ # Zip arm
47
+ for v in ${arms[@]} ; do
48
+ zip -r notable-${TAG} .linux-arm${v} .zip notable-${TAG} .linux-arm${v}
49
+ done
30
50
popd
31
51
32
52
# Change ownership inside the container to the user who ~ran the container
0 commit comments