forked from NorbertBodziony/zecwallet-light-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mkrelease.sh
executable file
·110 lines (94 loc) · 3.85 KB
/
mkrelease.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#!/bin/bash
# This script depends on a docker image already being built
# To build it,
# cd docker
# docker build --tag rustbuild:latest .
POSITIONAL=()
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
-v|--version)
APP_VERSION="$2"
shift # past argument
shift # past value
;;
*) # unknown option
POSITIONAL+=("$1") # save it in an array for later
shift # past argument
;;
esac
done
set -- "${POSITIONAL[@]}" # restore positional parameters
if [ -z $APP_VERSION ]; then echo "APP_VERSION is not set"; exit 1; fi
# Write the version file
echo "pub const VERSION:&str = \"$APP_VERSION\";" > cli/src/version.rs
# First, do the tests
cd lib && cargo test --release
retVal=$?
if [ $retVal -ne 0 ]; then
echo "Error"
exit $retVal
fi
cd ..
# Compile for mac directly
cargo build --release
#macOS
rm -rf target/macOS-zecwallet-cli-v$APP_VERSION
mkdir -p target/macOS-zecwallet-cli-v$APP_VERSION
cp target/release/zecwallet-cli target/macOS-zecwallet-cli-v$APP_VERSION/
# Now sign and zip the binaries
# macOS
gpg --batch --output target/macOS-zecwallet-cli-v$APP_VERSION/zecwallet-cli.sig --detach-sig target/macOS-zecwallet-cli-v$APP_VERSION/zecwallet-cli
cd target
cd macOS-zecwallet-cli-v$APP_VERSION
gsha256sum zecwallet-cli > sha256sum.txt
cd ..
zip -r macOS-zecwallet-cli-v$APP_VERSION.zip macOS-zecwallet-cli-v$APP_VERSION
cd ..
# For Windows and Linux, build via docker
docker run --rm -v $(pwd)/:/opt/zecwallet-light-cli rustbuild:latest bash -c "cd /opt/zecwallet-light-cli && cargo build --release && cargo build --release --target armv7-unknown-linux-gnueabihf && cargo build --release --target aarch64-unknown-linux-gnu && SODIUM_LIB_DIR='/opt/libsodium-win64/lib/' cargo build --release --target x86_64-pc-windows-gnu"
#Linux
rm -rf target/linux-zecwallet-cli-v$APP_VERSION
mkdir -p target/linux-zecwallet-cli-v$APP_VERSION
cp target/release/zecwallet-cli target/linux-zecwallet-cli-v$APP_VERSION/
gpg --batch --output target/linux-zecwallet-cli-v$APP_VERSION/zecwallet-cli.sig --detach-sig target/linux-zecwallet-cli-v$APP_VERSION/zecwallet-cli
cd target
cd linux-zecwallet-cli-v$APP_VERSION
gsha256sum zecwallet-cli > sha256sum.txt
cd ..
zip -r linux-zecwallet-cli-v$APP_VERSION.zip linux-zecwallet-cli-v$APP_VERSION
cd ..
#Windows
rm -rf target/Windows-zecwallet-cli-v$APP_VERSION
mkdir -p target/Windows-zecwallet-cli-v$APP_VERSION
cp target/x86_64-pc-windows-gnu/release/zecwallet-cli.exe target/Windows-zecwallet-cli-v$APP_VERSION/
gpg --batch --output target/Windows-zecwallet-cli-v$APP_VERSION/zecwallet-cli.sig --detach-sig target/Windows-zecwallet-cli-v$APP_VERSION/zecwallet-cli.exe
cd target
cd Windows-zecwallet-cli-v$APP_VERSION
gsha256sum zecwallet-cli.exe > sha256sum.txt
cd ..
zip -r Windows-zecwallet-cli-v$APP_VERSION.zip Windows-zecwallet-cli-v$APP_VERSION
cd ..
#Armv7
rm -rf target/Armv7-zecwallet-cli-v$APP_VERSION
mkdir -p target/Armv7-zecwallet-cli-v$APP_VERSION
cp target/armv7-unknown-linux-gnueabihf/release/zecwallet-cli target/Armv7-zecwallet-cli-v$APP_VERSION/
gpg --batch --output target/Armv7-zecwallet-cli-v$APP_VERSION/zecwallet-cli.sig --detach-sig target/Armv7-zecwallet-cli-v$APP_VERSION/zecwallet-cli
cd target
cd Armv7-zecwallet-cli-v$APP_VERSION
gsha256sum zecwallet-cli > sha256sum.txt
cd ..
zip -r Armv7-zecwallet-cli-v$APP_VERSION.zip Armv7-zecwallet-cli-v$APP_VERSION
cd ..
#AARCH64
rm -rf target/aarch64-zecwallet-cli-v$APP_VERSION
mkdir -p target/aarch64-zecwallet-cli-v$APP_VERSION
cp target/aarch64-unknown-linux-gnu/release/zecwallet-cli target/aarch64-zecwallet-cli-v$APP_VERSION/
gpg --batch --output target/aarch64-zecwallet-cli-v$APP_VERSION/zecwallet-cli.sig --detach-sig target/aarch64-zecwallet-cli-v$APP_VERSION/zecwallet-cli
cd target
cd aarch64-zecwallet-cli-v$APP_VERSION
gsha256sum zecwallet-cli > sha256sum.txt
cd ..
zip -r aarch64-zecwallet-cli-v$APP_VERSION.zip aarch64-zecwallet-cli-v$APP_VERSION
cd ..