cho: create_release v0.5.1

This commit is contained in:
Jack Wills
2024-01-23 21:09:43 +00:00
parent 0f65c9e7a7
commit 9b587ceb77
+77 -14
View File
@@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# rust create_release # rust create_release
# v0.4.1 # v0.5.1
STAR_LINE='****************************************' STAR_LINE='****************************************'
CWD=$(pwd) CWD=$(pwd)
@@ -18,6 +18,11 @@ error_close() {
exit 1 exit 1
} }
# Check that dialog is installed
if ! [ -x "$(command -v dialog)" ]; then
error_close "dialog is not installed"
fi
# $1 string - question to ask # $1 string - question to ask
ask_yn() { ask_yn() {
printf "%b%s? [y/N]:%b " "${GREEN}" "$1" "${RESET}" printf "%b%s? [y/N]:%b " "${GREEN}" "$1" "${RESET}"
@@ -173,27 +178,37 @@ cargo_publish() {
ask_continue ask_continue
} }
# Build all releases that GitHub workflow would cargo_build_x86_linux() {
# This will download GB's of docker images
cargo_build() {
cargo install cross
cargo_clean
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
ask_continue }
cargo_clean
cargo_build_aarch64_linux() {
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
ask_continue }
cargo_clean
cargo_build_armv6_linux() {
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
ask_continue }
cargo_clean
cargo_build_x86_windows() {
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
}
# 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 ask_continue
cargo_clean cargo_build_aarch64_linux
ask_continue
cargo_build_x86_linux
ask_continue
cargo_build_x86_windows
} }
# $1 text to colourise # $1 text to colourise
@@ -267,6 +282,9 @@ release_flow() {
release_continue "git checkout main" release_continue "git checkout main"
git checkout main git checkout main
echo -e "${PURPLE}git pull main${RESET}"
git pull origin main
echo -e "${PURPLE}git merge --no-ff \"${RELEASE_BRANCH}\" -m \"chore: merge ${RELEASE_BRANCH} into main\"${RESET}" echo -e "${PURPLE}git merge --no-ff \"${RELEASE_BRANCH}\" -m \"chore: merge ${RELEASE_BRANCH} into main\"${RESET}"
git merge --no-ff "$RELEASE_BRANCH" -m "chore: merge ${RELEASE_BRANCH} into main" git merge --no-ff "$RELEASE_BRANCH" -m "chore: merge ${RELEASE_BRANCH} into main"
echo -e "\n${PURPLE}cargo check${RESET}\n" echo -e "\n${PURPLE}cargo check${RESET}\n"
@@ -291,6 +309,51 @@ release_flow() {
git branch -d "$RELEASE_BRANCH" git branch -d "$RELEASE_BRANCH"
} }
build_choice() {
cmd=(dialog --backtitle "Choose option" --radiolist "choose" 14 80 16)
options=(
1 "x86 musl linux" off
2 "aarch64 musl linux" off
3 "armv6 musl linux" off
4 "x86 windows" off
5 "all" off
)
choices=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty)
exitStatus=$?
clear
if [ $exitStatus -ne 0 ]; then
exit
fi
for choice in $choices; do
case $choice in
0)
exit
;;
1)
cargo_build_x86_linux
exit
;;
2)
cargo_build_aarch64_linux
exit
;;
3)
cargo_build_armv6_linux
exit
;;
4)
cargo_build_x86_windows
exit
;;
5)
cargo_build_all
exit
;;
esac
done
}
main() { main() {
cmd=(dialog --backtitle "Choose option" --radiolist "choose" 14 80 16) cmd=(dialog --backtitle "Choose option" --radiolist "choose" 14 80 16)
options=( options=(
@@ -319,7 +382,7 @@ main() {
break break
;; ;;
3) 3)
cargo_build build_choice
main main
break break
;; ;;