-
Notifications
You must be signed in to change notification settings - Fork 1
/
build
executable file
·38 lines (30 loc) · 909 Bytes
/
build
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
#!/bin/sh
set -eu
prog_name="$(basename "$PWD")"
build_dir="./release"
export GOARCH=amd64
declare -A build_files
build_files[darwin]="${prog_name}-darwin_${GOARCH}"
build_files[linux]="${prog_name}-linux_${GOARCH}"
build_files[windows]="${prog_name}-windows_${GOARCH}.exe"
rm -fr -- "${build_dir}"
mkdir -p -- "${build_dir}"
printf '\e[34m-> Building\e[0m\n'
for os in ${!build_files[@]}; do
f="${build_files[$os]}"
echo " - $f"
GOOS="${os}" go build -ldflags='-s -w' -o "${build_dir}/$f"
done
cd -- "${build_dir}"
printf '\e[34m-> Generating checksums\e[0m\n'
for os in ${!build_files[@]}; do
f="${build_files[$os]}"
echo " - $f"
sha256sum "$f" >> "$f.sha256"
done
printf '\e[34m-> Generating signatures\e[0m\n'
for os in ${!build_files[@]}; do
f="${build_files[$os]}"
echo " - $f"
gpg --quiet --yes --default-key Krakozaure --output "$f.sha256.sig" --detach-sign "$f.sha256"
done