2023-10-16 05:40:09 +03:00
|
|
|
#!/bin/bash
|
|
|
|
set -euo pipefail
|
|
|
|
|
2024-03-03 10:36:49 +03:00
|
|
|
export ARTIFACT_NAME="yazi-$1"
|
|
|
|
export YAZI_GEN_COMPLETIONS=1
|
2024-08-22 18:41:02 +03:00
|
|
|
export MACOSX_DEPLOYMENT_TARGET="10.11"
|
2023-10-16 05:40:09 +03:00
|
|
|
|
2024-03-03 10:36:49 +03:00
|
|
|
# Setup Rust toolchain
|
2024-04-23 11:35:17 +03:00
|
|
|
if [[ "$1" == *-musl ]]; then
|
|
|
|
rustup target add "$1"
|
|
|
|
else
|
|
|
|
rustup toolchain install stable --profile minimal --target "$1"
|
|
|
|
fi
|
2023-07-19 04:08:36 +03:00
|
|
|
|
2024-03-03 10:36:49 +03:00
|
|
|
# Build for the target
|
2024-08-16 13:21:13 +03:00
|
|
|
cargo build --release --locked --target "$1"
|
2023-07-19 04:08:36 +03:00
|
|
|
|
2024-03-03 10:36:49 +03:00
|
|
|
# Create the artifact
|
2024-04-16 07:40:14 +03:00
|
|
|
mkdir -p "$ARTIFACT_NAME/completions"
|
2024-04-15 10:42:44 +03:00
|
|
|
cp "target/$1/release/ya" "$ARTIFACT_NAME"
|
2024-03-03 10:36:49 +03:00
|
|
|
cp "target/$1/release/yazi" "$ARTIFACT_NAME"
|
2024-04-16 07:40:14 +03:00
|
|
|
cp yazi-cli/completions/* "$ARTIFACT_NAME/completions"
|
|
|
|
cp yazi-boot/completions/* "$ARTIFACT_NAME/completions"
|
2024-03-03 10:36:49 +03:00
|
|
|
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"
|