-
Notifications
You must be signed in to change notification settings - Fork 0
/
make_binaries.sh
executable file
·63 lines (52 loc) · 1.17 KB
/
make_binaries.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
52
53
54
55
56
57
58
59
60
61
62
63
#!/usr/bin/env bash
set -euo pipefail
ARTIFACT="bart"
RELEASE_INFO="release_info.md"
GIT_REVISION=$(git rev-parse HEAD)
GO_VERSION=$(go version)
rm -f \
"./$RELEASE_INFO" \
"./$ARTIFACT" \
"./$ARTIFACT.exe" \
"./${ARTIFACT}_macos_x64.tar.gz" \
"./${ARTIFACT}_linux_x64.tar.gz" \
"./${ARTIFACT}_windows_x64.zip"
# $1 File to be hashed
# $2 Target filename
function generate_digests {
local SHA_256_DIGEST=$(sha256sum $1)
local SHA_512_DIGEST=$(sha512sum $1)
cat >> "$2" <<EOF
SHA256 digest:
\`\`\`
$SHA_256_DIGEST
\`\`\`
SHA512 digest:
\`\`\`
$SHA_512_DIGEST
\`\`\`
EOF
}
cat >> "$RELEASE_INFO" <<EOF
# \`$ARTIFACT\` binaries
git revision:
\`\`\`
$GIT_REVISION
\`\`\`
Go compiler version:
\`\`\`
$GO_VERSION
\`\`\`
## Linux x64
EOF
make xcompile_linux
generate_digests "$ARTIFACT" "$RELEASE_INFO"
tar -cvzf "${ARTIFACT}_linux_x64.tar.gz" "$ARTIFACT"
printf "\n## macOS x64\n\n" >> "$RELEASE_INFO"
make xcompile_mac
generate_digests "$ARTIFACT" "$RELEASE_INFO"
tar -cvzf "${ARTIFACT}_macos_x64.tar.gz" "$ARTIFACT"
printf "\n## Windows x64\n\n" >> "$RELEASE_INFO"
make xcompile_win
generate_digests "$ARTIFACT.exe" "$RELEASE_INFO"
zip "${ARTIFACT}_windows_x64.zip" "$ARTIFACT.exe"