outfly/build/pack.sh

55 lines
2.4 KiB
Bash
Raw Normal View History

#!/bin/bash
2024-04-21 18:23:40 +02:00
# ▄████████▄ + ███ + ▄█████████ ███ +
# ███▀ ▀███ + + ███ ███▀ + ███ + +
# ███ + ███ ███ ███ █████████ ███ ███ ███ ███
2024-04-21 19:34:00 +02:00
# ███ +███ ███ ███ ███ ███▐██████ ███ ███ ███
2024-04-21 18:23:40 +02:00
# ███ + ███ ███+ ███ +███ ███ + ███ ███ + ███
# ███▄ ▄███ ███▄ ███ ███ + ███ + ███ ███▄ ███
# ▀████████▀ + ▀███████ ███▄ ███▄ ▀████ ▀███████
# + + + ███
# + ▀████████████████████████████████████████████████████▀
#
2024-03-31 19:58:22 +02:00
# A script to package release binaries + README.md into zip files.
2024-05-12 23:15:17 +02:00
# Usage: cd outfly; build/pack.sh [-b]
2024-04-23 17:57:11 +02:00
# Options: -b: cross-compile targets before packing
2024-03-31 19:49:59 +02:00
set -e
function check_uncommitted_assets() {
( cd assets; [ $(git status --porcelain . | wc -l) -gt 0 ] )
}
if check_uncommitted_assets; then
echo "Please make sure there are no uncommited files in the 'asset' directory before packing"
exit 1
fi
2024-04-02 17:39:57 +02:00
if [ "$1" == "-b" ]; then
cargo build --release --target=x86_64-unknown-linux-gnu --no-default-features --features release_linux
cargo build --release --target=x86_64-pc-windows-gnu --no-default-features --features release_windows
2024-04-02 17:39:57 +02:00
fi
2024-05-14 18:25:07 +02:00
VERSION="$(sed -nr 's/^\s*version\s*=\s*"(.*)"\s*$/\1/p' Cargo.toml | head -n1)"
test -z "$VERSION" && echo 'Error: Could not extract version from Cargo.toml' && exit
echo "Extracted version from Cargo.toml: $VERSION"
2024-03-31 19:49:59 +02:00
TMPPATH=ZIP_TMP_PATH
mkdir "$TMPPATH"
cd "$TMPPATH"
SRCPATH="outfly_v$VERSION"
mkdir "$SRCPATH"
cp ../README.md "$SRCPATH"
2024-04-29 15:43:00 +02:00
cp ../LICENSE.md "$SRCPATH"
2024-04-29 15:57:37 +02:00
cp ../CHANGELOG.md "$SRCPATH"
2024-04-19 23:47:40 +02:00
cp ../target/x86_64-pc-windows-gnu/release/outfly.exe "$SRCPATH"/OutFly.exe
2024-03-31 19:49:59 +02:00
zip -v -r -9 ../"outfly_v${VERSION}_windows.zip" "$SRCPATH"
2024-04-19 23:47:40 +02:00
rm "$SRCPATH"/OutFly.exe
2024-04-16 01:40:57 +02:00
cp ../target/x86_64-unknown-linux-gnu/release/outfly "$SRCPATH"
2024-03-31 19:49:59 +02:00
zip -v -r -9 ../"outfly_v${VERSION}_linux.zip" "$SRCPATH"
cd ..
rm -rf "$TMPPATH"