Skip to content

Commit

Permalink
chore: create_release v0.5.5
Browse files Browse the repository at this point in the history
  • Loading branch information
mrjackwills committed Feb 12, 2024
1 parent c3e9429 commit 616338b
Showing 1 changed file with 24 additions and 19 deletions.
43 changes: 24 additions & 19 deletions create_release.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/bin/bash

# rust create_release
# v0.5.1
# rust create_release v0.5.5

STAR_LINE='****************************************'
CWD=$(pwd)
Expand Down Expand Up @@ -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}"
}

Expand Down Expand Up @@ -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
Expand All @@ -178,30 +174,41 @@ 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
}

# 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
Expand All @@ -217,26 +224,23 @@ 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}"
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
}

Expand Down Expand Up @@ -270,6 +274,7 @@ release_flow() {

echo -e "\ncargo fmt"
cargo fmt

echo -e "\n${PURPLE}cargo check${RESET}\n"
cargo check

Expand Down

0 comments on commit 616338b

Please # to comment.