Skip to content

Commit

Permalink
chore: create_release.sh updated
Browse files Browse the repository at this point in the history
  • Loading branch information
mrjackwills committed Oct 19, 2024
1 parent b0c75e4 commit 028f41d
Showing 1 changed file with 22 additions and 18 deletions.
40 changes: 22 additions & 18 deletions create_release.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/bin/bash

# rust create_release
# v0.3.0
# v0.6.0
# 2024-10-19

STAR_LINE='****************************************'
CWD=$(pwd)
Expand All @@ -19,14 +20,26 @@ error_close() {
}

# $1 string - question to ask
ask_yn () {
printf "%b%s? [y/N]:%b " "${GREEN}" "$1" "${RESET}"
# Ask a yes no question, only accepts `y` or `n` as a valid answer, returns 0 for yes, 1 for no
ask_yn() {
while true; do
printf "\n%b%s? [y/N]:%b " "${GREEN}" "$1" "${RESET}"
read -r answer
if [[ "$answer" == "y" ]]; then
return 0
elif [[ "$answer" == "n" ]]; then
return 1
else
echo -e "${RED}\nPlease enter 'y' or 'n'${RESET}"
fi
done
}

# return user input
user_input() {
read -r data
echo "$data"
# ask continue, or quit
ask_continue () {
if ! ask_yn "continue"; then
exit
fi
}

update_major () {
Expand Down Expand Up @@ -77,9 +90,7 @@ ask_changelog_update() {
RELEASE_BODY_TEXT=$(sed '/# <a href=/Q' CHANGELOG.md)
printf "%s" "$RELEASE_BODY_TEXT"
printf "\n%s\n" "${STAR_LINE}"
ask_yn "accept release body"
if [[ "$(user_input)" =~ ^y$ ]]
then
if ask_yn "accept release body"; then
update_release_body_and_changelog "$RELEASE_BODY_TEXT"
else
exit
Expand Down Expand Up @@ -154,14 +165,7 @@ check_tag () {
done
}

# ask continue, or quit
ask_continue () {
ask_yn "continue"
if [[ ! "$(user_input)" =~ ^y$ ]]
then
exit
fi
}


# run all tests
cargo_test () {
Expand Down

0 comments on commit 028f41d

Please sign in to comment.