mirror of
https://github.com/denisidoro/navi
synced 2024-11-22 19:43:06 +00:00
50 lines
1 KiB
Bash
Executable file
50 lines
1 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
##? action release
|
|
|
|
export NAVI_HOME="$(cd "$(dirname "$0")/.." && pwd)"
|
|
source "${NAVI_HOME}/scripts/install"
|
|
|
|
release() {
|
|
|
|
TAR_DIR="${NAVI_HOME}/target/tar"
|
|
|
|
target="${1:-}"
|
|
if [[ $target == *"osx"* ]]; then
|
|
echoerr "OSX cross-compile is impossible. Fallbacking to cargo..."
|
|
target=""
|
|
fi
|
|
|
|
cd "$NAVI_HOME"
|
|
|
|
rm -rf "${NAVI_HOME}/target" 2> /dev/null || true
|
|
|
|
if [ -n "$target" ]; then
|
|
cargo install cross 2> /dev/null || true
|
|
cross build --release --locked --target "$target"
|
|
bin_folder="${target}/release"
|
|
else
|
|
cargo build --release --locked
|
|
bin_folder="release"
|
|
fi
|
|
|
|
bin_path="${NAVI_HOME}/target/${bin_folder}/navi"
|
|
chmod +x "$bin_path"
|
|
mkdir -p "$TAR_DIR" 2> /dev/null || true
|
|
|
|
cp -r "${NAVI_HOME}/cheats" "$TAR_DIR"
|
|
cp -r "${NAVI_HOME}/shell" "$TAR_DIR"
|
|
cp "$bin_path" "$TAR_DIR"
|
|
|
|
cd "${NAVI_HOME}/target/tar"
|
|
tar -czf navi.tar.gz *
|
|
|
|
}
|
|
|
|
cmd="$1"
|
|
shift
|
|
|
|
case "$cmd" in
|
|
"release") release "$@" ;;
|
|
esac
|