feat: Bundle script
This commit is contained in:
parent
a8aacd1df5
commit
e94e779fec
1 changed files with 43 additions and 0 deletions
43
scripts/bundle.sh
Executable file
43
scripts/bundle.sh
Executable file
|
|
@ -0,0 +1,43 @@
|
|||
#!/bin/sh
|
||||
|
||||
print_usage() {
|
||||
echo "Usage: scripts/bundle.sh [TARGET]"
|
||||
}
|
||||
|
||||
fail() {
|
||||
echo "$1"
|
||||
exit 1
|
||||
}
|
||||
|
||||
if [ ! -n "$1" ]; then
|
||||
print_usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
toml --version > /dev/null || fail "toml-cli is required to fetch version from Cargo.toml"
|
||||
|
||||
version=$(toml get -r Cargo.toml package.version)
|
||||
|
||||
target=$1
|
||||
|
||||
extension=""
|
||||
|
||||
case "$target" in
|
||||
*"windows"*)
|
||||
exe=".exe"
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "Building aliveline$exe for $target..."
|
||||
|
||||
cargo build --release --target $target || fail "Could not build aliveline for target $target"
|
||||
|
||||
prefix=target/$target/release
|
||||
binary_name=aliveline-$version-$target$exe
|
||||
|
||||
echo "Renaming aliveline$exe to $binary_name..."
|
||||
mv -v $prefix/aliveline$exe $prefix/$binary_name
|
||||
|
||||
echo "Computing checksum..."
|
||||
cd $prefix
|
||||
sha256sum $binary_name > $binary_name.sha256
|
||||
Loading…
Add table
Add a link
Reference in a new issue