forked from tealdeer-rs/tealdeer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
release-build.sh
executable file
·62 lines (49 loc) · 1.54 KB
/
release-build.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
#!/usr/bin/env bash
set -euo pipefail
VERSION=$(grep '^version = ' Cargo.toml | sed 's/.*"\([0-9\.]*\)".*/\1/')
GPG_KEY=EA456E8BAF0109429583EED83578F667F2F3A5FA
declare -a targets=(
"x86_64-musl"
"i686-musl"
"armv7-musleabihf"
"arm-musleabi"
"arm-musleabihf"
)
declare -a rusttargets=(
"x86_64-unknown-linux-musl"
"i686-unknown-linux-musl"
"armv7-unknown-linux-musleabihf"
"arm-unknown-linux-musleabi"
"arm-unknown-linux-musleabihf"
)
function docker-download {
echo "==> Downloading Docker image: messense/rust-musl-cross:$1"
docker pull messense/rust-musl-cross:$1
}
function docker-build {
echo "==> Building target: $1"
docker run --rm -it -v "$(pwd)":/home/rust/src messense/rust-musl-cross:$1 cargo build --release
}
echo -e "==> Version $VERSION\n"
for target in ${targets[@]}; do docker-download $target; done
echo ""
for target in ${targets[@]}; do docker-build $target; done
echo ""
rm -rf "dist-$VERSION"
mkdir "dist-$VERSION"
for i in ${!targets[@]}; do
echo "==> Copying ${targets[$i]}"
cp "target/${rusttargets[$i]}/release/tldr" "dist-$VERSION/tldr-${targets[$i]}"
done
echo ""
for target in ${targets[@]}; do
echo "==> Stripping $target"
docker run --rm -it -v "$(pwd)":/home/rust/src messense/rust-musl-cross:$target musl-strip -s /home/rust/src/dist-$VERSION/tldr-$target
done
echo ""
for target in ${targets[@]}; do
echo "==> Signing $target"
gpg -a --output "dist-$VERSION/tldr-$target.sig" --detach-sig "dist-$VERSION/tldr-$target"
done
echo ""
echo "Done."