yazi/scripts/build.sh

30 lines
867 B
Bash
Raw Normal View History

2023-10-16 05:40:09 +03:00
#!/bin/bash
set -euo pipefail
export ARTIFACT_NAME="yazi-$1"
export YAZI_GEN_COMPLETIONS=1
export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=/usr/bin/aarch64-linux-gnu-gcc
2023-10-16 05:40:09 +03:00
# Setup Rust toolchain
rustup toolchain install stable --profile minimal
rustup target add "$1"
2023-07-19 04:08:36 +03:00
# Build for the target
cargo build -p yazi-cli --release --locked --target "$1"
cargo build -p yazi-fm --release --locked --target "$1"
2023-07-19 04:08:36 +03:00
# Create the artifact
mkdir -p "$ARTIFACT_NAME/completions"
cp "target/$1/release/ya" "$ARTIFACT_NAME"
cp "target/$1/release/yazi" "$ARTIFACT_NAME"
cp yazi-cli/completions/* "$ARTIFACT_NAME/completions"
cp yazi-boot/completions/* "$ARTIFACT_NAME/completions"
cp README.md LICENSE "$ARTIFACT_NAME"
# Zip the artifact
if ! command -v zip &> /dev/null
then
sudo apt-get update && sudo apt-get install -yq zip
fi
zip -r "$ARTIFACT_NAME.zip" "$ARTIFACT_NAME"