-
Notifications
You must be signed in to change notification settings - Fork 10
/
brew_bottle.sh
executable file
·56 lines (42 loc) · 1003 Bytes
/
brew_bottle.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
#!/bin/sh
# Bottle a release for brew:
# Usage `./brew-bottle.sh 1.0`
# run only on macos
VERSION="$1"
if [ -z "$VERSION" ]
then
echo "Must pass version, like '1.0' as a parameter"
exit 1
else
echo "Bottling version $VERSION ..."
fi
# build and release
main() {
need_cmd cargo
need_cmd tar
need_cmd gh
build_artifacts
create_github_release
rm *.bottle.tar.gz
}
# build the bottles
build_artifacts() {
cargo build --release
mkdir -p /tmp/akr/$VERSION/bin
cp ./target/release/akr /tmp/akr/$VERSION/bin/
tar -czf akr-$VERSION.big_sur.bottle.tar.gz -C /tmp akr
cp akr-$VERSION.big_sur.bottle.tar.gz akr-$VERSION.catalina.bottle.tar.gz
ls *.bottle.tar.gz
# clean up
rm -rf /tmp/akr
}
create_github_release() {
gh release create --generate-notes $VERSION *.bottle.tar.gz
}
# tests that a command exists
need_cmd() {
if ! command -v "$1" > /dev/null 2>&1
then err "need '$1' (command not found)"
fi
}
main