chore: create_release v0.5.5

This commit is contained in:
Jack Wills
2024-02-12 16:38:16 +00:00
parent c3e9429bc3
commit 616338b710
+23 -18
View File
@@ -1,7 +1,6 @@
#!/bin/bash #!/bin/bash
# rust create_release # rust create_release v0.5.5
# v0.5.1
STAR_LINE='****************************************' STAR_LINE='****************************************'
CWD=$(pwd) CWD=$(pwd)
@@ -34,21 +33,26 @@ user_input() {
echo "$data" echo "$data"
} }
# semver major update
update_major() { update_major() {
local bumped_major local bumped_major
bumped_major=$((MAJOR + 1)) bumped_major=$((MAJOR + 1))
echo "${bumped_major}.0.0" echo "${bumped_major}.0.0"
} }
# semver minor update
update_minor() { update_minor() {
local bumped_minor local bumped_minor
bumped_minor=$((MINOR + 1)) bumped_minor=$((MINOR + 1))
MINOR=bumped_minor
echo "${MAJOR}.${bumped_minor}.0" echo "${MAJOR}.${bumped_minor}.0"
} }
# semver patch update
update_patch() { update_patch() {
local bumped_patch local bumped_patch
bumped_patch=$((PATCH + 1)) bumped_patch=$((PATCH + 1))
PATCH=bumped_patch
echo "${MAJOR}.${MINOR}.${bumped_patch}" echo "${MAJOR}.${MINOR}.${bumped_patch}"
} }
@@ -158,14 +162,6 @@ check_tag() {
done done
} }
# ask continue, or quit
ask_continue() {
ask_yn "continue"
if [[ ! "$(user_input)" =~ ^y$ ]]; then
exit
fi
}
# run all tests # run all tests
cargo_test() { cargo_test() {
cargo test -- --test-threads=1 cargo test -- --test-threads=1
@@ -178,22 +174,34 @@ cargo_publish() {
ask_continue 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() { cargo_build_x86_linux() {
check_cross
echo -e "${YELLOW}cross build --target x86_64-unknown-linux-musl --release${RESET}" echo -e "${YELLOW}cross build --target x86_64-unknown-linux-musl --release${RESET}"
cross build --target x86_64-unknown-linux-musl --release cross build --target x86_64-unknown-linux-musl --release
} }
cargo_build_aarch64_linux() { cargo_build_aarch64_linux() {
check_cross
echo -e "${YELLOW}cross build --target aarch64-unknown-linux-musl --release${RESET}" echo -e "${YELLOW}cross build --target aarch64-unknown-linux-musl --release${RESET}"
cross build --target aarch64-unknown-linux-musl --release cross build --target aarch64-unknown-linux-musl --release
} }
cargo_build_armv6_linux() { cargo_build_armv6_linux() {
check_cross
echo -e "${YELLOW}cross build --target arm-unknown-linux-musleabihf --release${RESET}" echo -e "${YELLOW}cross build --target arm-unknown-linux-musleabihf --release${RESET}"
cross build --target arm-unknown-linux-musleabihf --release cross build --target arm-unknown-linux-musleabihf --release
} }
cargo_build_x86_windows() { cargo_build_x86_windows() {
check_cross
echo -e "${YELLOW}cross build --target x86_64-pc-windows-gnu --release${RESET}" echo -e "${YELLOW}cross build --target x86_64-pc-windows-gnu --release${RESET}"
cross build --target x86_64-pc-windows-gnu --release cross build --target x86_64-pc-windows-gnu --release
} }
@@ -201,7 +209,6 @@ cargo_build_x86_windows() {
# Build all releases that GitHub workflow would # Build all releases that GitHub workflow would
# This will download GB's of docker images # This will download GB's of docker images
cargo_build_all() { cargo_build_all() {
cargo install cross
cargo_build_armv6_linux cargo_build_armv6_linux
ask_continue ask_continue
cargo_build_aarch64_linux cargo_build_aarch64_linux
@@ -217,11 +224,6 @@ release_continue() {
ask_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 repository for typos
check_typos() { check_typos() {
echo -e "\n${PURPLE}check typos${RESET}" echo -e "\n${PURPLE}check typos${RESET}"
@@ -234,9 +236,11 @@ check_allow_unused() {
matches_any=$(find . -type d \( -name .git -o -name target \) -prune -o -type f -exec grep -lE '^#!\[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) matches_cargo=$(grep "^unused = \"allow\"" ./Cargo.toml)
if [ -n "$matches_any" ]; then 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 elif [ -n "$matches_cargo" ]; then
error_close "\"unused = \"allow\"\" in Cargo.toml" echo "\"unused = \"allow\"\" in Cargo.toml"
ask_continue
fi fi
} }
@@ -270,6 +274,7 @@ release_flow() {
echo -e "\ncargo fmt" echo -e "\ncargo fmt"
cargo fmt cargo fmt
echo -e "\n${PURPLE}cargo check${RESET}\n" echo -e "\n${PURPLE}cargo check${RESET}\n"
cargo check cargo check