-
Notifications
You must be signed in to change notification settings - Fork 64
/
release.sh
executable file
·51 lines (37 loc) · 1.29 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
#!/bin/bash
os_list="linux darwin windows openbsd freebsd netbsd"
arch_linux="386 amd64 arm"
arch_darwin="amd64"
arch_windows="386 amd64"
arch_openbsd="386 amd64 arm"
arch_freebsd="386 amd64 arm"
arch_netbsd="386 amd64 arm"
suffix_windows=".exe"
package_prefix="github.com/mayflower/docker-ls"
packages="cli/docker-ls cli/docker-rm"
echo
go test github.com/mayflower/docker-ls/lib/... || exit 1
go generate github.com/mayflower/docker-ls/lib/... || exit 1
test -d release && rm -fr release
mkdir release
mkdir release/archives
for os in $os_list; do
arch_list="arch_$os"
suffix="suffix_$os"
suffix="${!suffix}"
for arch in ${!arch_list}; do
echo building for $os $arch
target_dir="release/${os}_${arch}"
mkdir -p "$target_dir"
for package in $packages; do
full_package="$package_prefix/$package"
binary="$target_dir/${full_package##*/}$suffix"
CGO_ENABLED=0 GOOS="$os" GOARM=5 GOARCH="$arch" go build -o "$binary" "$full_package" || exit 1
done
echo archiving for $os $arch
zipfile="release/archives/docker-ls-${os}-${arch}.zip"
shafile="$zipfile.sha256"
zip --junk-paths "$zipfile" $target_dir/*
cat "$zipfile" | shasum -a 256 | awk '{print $1;}' > "$shafile"
done
done