outfly/doc/scripts/pack.sh

33 lines
845 B
Bash
Raw Permalink Normal View History

2024-03-31 17:49:59 +00:00
#!/bin/sh
2024-03-31 17:58:22 +00:00
# A script to package release binaries + README.md into zip files.
# Usage: cd outfly; doc/scripts/pack.sh
2024-03-31 17:49:59 +00:00
set -e
2024-04-02 15:39:57 +00:00
if [ "$1" == "-b" ]; then
cargo build --release
cargo build --target=x86_64-pc-windows-gnu --release
fi
VERSION="$(sed -nr 's/^\s*version\s*=\s*"(.*)"\s*$/\1/p' Cargo.toml)"
test -z "$VERSION" && echo 'Error: Could not extract version from Cargo.toml' && exit
echo "Extracted version from Cargo.toml: $VERSION"
2024-03-31 17:49:59 +00:00
TMPPATH=ZIP_TMP_PATH
mkdir "$TMPPATH"
cd "$TMPPATH"
SRCPATH="outfly_v$VERSION"
mkdir "$SRCPATH"
cp ../README.md "$SRCPATH"
cp ../target/x86_64-pc-windows-gnu/release/outfly.exe "$SRCPATH"
zip -v -r -9 ../"outfly_v${VERSION}_windows.zip" "$SRCPATH"
rm "$SRCPATH"/outfly.exe
cp ../target/release/outfly "$SRCPATH"
zip -v -r -9 ../"outfly_v${VERSION}_linux.zip" "$SRCPATH"
cd ..
rm -rf "$TMPPATH"