-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.sh
executable file
·41 lines (32 loc) · 1.05 KB
/
deploy.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
#!/bin/bash
PRIVKEY=$1
# Create fresh artifacts folder.
rm -rf artifacts
mkdir artifacts
# Return first error encountered by any command.
set -e
# Generate public key from private key.
echo "$PRIVKEY" | openssl rsa -in - -outform PEM -pubout -out artifacts/pubkey.pem
# Build binaries and sign them.
for arch in amd64 arm; do
for os in darwin linux windows; do
for pkg in siac siad; do
# Ignore unsupported arch/os combinations.
if [ "$arch" == "arm" ]; then
if [ "$os" == "windows" ] || [ "$os" == "darwin" ]; then
continue
fi
fi
# Binaries are called 'siac' and i'siad'.
bin=$pkg
# Different naming convention for windows.
if [ "$os" == "windows" ]; then
bin=${pkg}.exe
fi
# Build binary.
GOOS=${os} GOARCH=${arch} go build -tags='netgo' -o artifacts/$arch/$os/$bin ./cmd/$pkg
# Sign binary.
echo "$PRIVKEY" | openssl dgst -sha256 -sign - -out artifacts/$arch/$os/$bin.sha256 artifacts/$arch/$os/$bin
done
done
done