Skip to content

Commit 58879f8

Browse files
committed
Add script to make release binaries
Signed-off-by: Daniel Lublin <[email protected]>
1 parent df41dd9 commit 58879f8

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

make-release-binaries.sh

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#!/bin/sh -e
2+
3+
if ! git diff-index --quiet --cached HEAD --; then
4+
printf "repo has staged changes\n"
5+
exit 1
6+
fi
7+
8+
version="$(git describe --dirty --always | sed -n "s/^v\([0-9]\+\.[0-9]\+\.[0-9]\+\)/\1/p")"
9+
if [ -z "$version" ]; then
10+
printf "found no tag (with v-prefix) to use for version\n"
11+
exit 1
12+
fi
13+
14+
rest="$(printf "%s" "$version" | sed -n "s/^[0-9]\+\.[0-9]\+\.[0-9]\+\(.*\)$/\1/p")"
15+
16+
if [ -n "$rest" ]; then
17+
printf "%s: repo has commit after last tag, or git tree is dirty\n" "$version"
18+
exit 1
19+
fi
20+
21+
if [ -e release ]; then
22+
printf "release dir already exists\n"
23+
exit 1
24+
fi
25+
26+
make -s clean
27+
28+
make appbins-from-tags
29+
30+
printf "Building release binaries for version %s\n" "$version"
31+
32+
cp vendor-signing-pubkeys.txt ./internal/vendorsigning/vendor-signing-pubkeys.txt
33+
34+
mkdir release
35+
36+
cmd="tkey-verification"
37+
export GOARCH=amd64
38+
39+
export CGO_ENABLED=0
40+
GOOS=linux go build -v -ldflags "-X main.version=$version" -o "release/${cmd}_${version}_linux-$GOARCH" ./cmd/$cmd
41+
GOOS=windows go build -v -ldflags "-X main.version=$version" -o "release/${cmd}_${version}_windows-$GOARCH" ./cmd/$cmd
42+
43+
export CGO_ENABLED=1
44+
# TODO can't build for macos, go-serial/enumerator requires libs/C stuff on the
45+
# host compile (and also CGO ofcourse)
46+
#GOOS=darwin go build -v -ldflags "-X main.version=$version" -o "release/${cmd}_${version}_macos-$GOARCH" ./cmd/$cmd
47+
48+
cd release
49+
for f in "$cmd"_*; do
50+
sha512sum "$f" >"$f.sha512"
51+
done
52+
cd ..
53+
54+
make -s clean
55+
56+
ls -l release/*

0 commit comments

Comments
 (0)