#! /bin/bash # set -ex RELEASE_VERSION=${BUILD_VERSION:-0.1} function set_version() { date=$(git show --pretty=format:"%ci %cr" | head -1 | cut -d " " -f1) commit=$(git rev-parse HEAD | cut -c1-10) RELEASE_VERSION="$RELEASE_VERSION ($commit $date)" sed -i "s|version = \".*\"|version = \"$RELEASE_VERSION\"|" ./src/main.rs } function build_target() { platform=$1 name=$2 rm -rf target/release/build && cross build --release --target $platform [ -d "./dist" ] || mkdir -p dist cp target/$platform/release/$name ./dist/$platform.$name cd ./dist && tar -czvf autossh.$platform.tar.gz $platform.$name && cd .. # && rm -rf $platform.$name echo "[+] $RELEASE_VERSION build success, output file: dist/autossh.$platform.tar.gz" } function build() { cross_info=$( cat <