diff --git a/create_release.sh b/create_release.sh index b7bd829..afa1f0a 100755 --- a/create_release.sh +++ b/create_release.sh @@ -1,7 +1,6 @@ #!/bin/bash -# rust create_release -# v0.5.1 +# rust create_release v0.5.5 STAR_LINE='****************************************' CWD=$(pwd) @@ -34,21 +33,26 @@ user_input() { echo "$data" } +# semver major update update_major() { local bumped_major bumped_major=$((MAJOR + 1)) echo "${bumped_major}.0.0" } +# semver minor update update_minor() { local bumped_minor bumped_minor=$((MINOR + 1)) + MINOR=bumped_minor echo "${MAJOR}.${bumped_minor}.0" } +# semver patch update update_patch() { local bumped_patch bumped_patch=$((PATCH + 1)) + PATCH=bumped_patch echo "${MAJOR}.${MINOR}.${bumped_patch}" } @@ -158,14 +162,6 @@ check_tag() { done } -# ask continue, or quit -ask_continue() { - ask_yn "continue" - if [[ ! "$(user_input)" =~ ^y$ ]]; then - exit - fi -} - # run all tests cargo_test() { cargo test -- --test-threads=1 @@ -178,22 +174,34 @@ cargo_publish() { ask_continue } +# Check to see if cross is installed - if not then install +check_cross() { + if ! [ -x "$(command -v cross)" ]; then + echo -e "${GREEN}cargo install cross${RESET}" + cargo install cross + fi +} + cargo_build_x86_linux() { + check_cross echo -e "${YELLOW}cross build --target x86_64-unknown-linux-musl --release${RESET}" cross build --target x86_64-unknown-linux-musl --release } cargo_build_aarch64_linux() { + check_cross echo -e "${YELLOW}cross build --target aarch64-unknown-linux-musl --release${RESET}" cross build --target aarch64-unknown-linux-musl --release } cargo_build_armv6_linux() { + check_cross echo -e "${YELLOW}cross build --target arm-unknown-linux-musleabihf --release${RESET}" cross build --target arm-unknown-linux-musleabihf --release } cargo_build_x86_windows() { + check_cross echo -e "${YELLOW}cross build --target x86_64-pc-windows-gnu --release${RESET}" cross build --target x86_64-pc-windows-gnu --release } @@ -201,7 +209,6 @@ cargo_build_x86_windows() { # Build all releases that GitHub workflow would # This will download GB's of docker images cargo_build_all() { - cargo install cross cargo_build_armv6_linux ask_continue cargo_build_aarch64_linux @@ -217,11 +224,6 @@ release_continue() { ask_continue } -# Clean/remove builds, due to issue with cross-rs -cargo_clean() { - echo -e "${YELLOW}cargo clean${RESET}" - cargo clean -} # Check repository for typos check_typos() { echo -e "\n${PURPLE}check typos${RESET}" @@ -229,14 +231,16 @@ check_typos() { ask_continue } -# Make sure the unused lint isn't used +# Make sure the unused lint isn't used check_allow_unused() { matches_any=$(find . -type d \( -name .git -o -name target \) -prune -o -type f -exec grep -lE '^#!\[allow\(unused\)\]$' {} +) matches_cargo=$(grep "^unused = \"allow\"" ./Cargo.toml) if [ -n "$matches_any" ]; then - error_close "\"#[allow(unused)]\" in ${matches_any}" + echo "\"#[allow(unused)]\" in ${matches_any}" + ask_continue elif [ -n "$matches_cargo" ]; then - error_close "\"unused = \"allow\"\" in Cargo.toml" + echo "\"unused = \"allow\"\" in Cargo.toml" + ask_continue fi } @@ -270,6 +274,7 @@ release_flow() { echo -e "\ncargo fmt" cargo fmt + echo -e "\n${PURPLE}cargo check${RESET}\n" cargo check