diff --git a/create_release.sh b/create_release.sh index 5cd9edb..297e54c 100755 --- a/create_release.sh +++ b/create_release.sh @@ -1,7 +1,7 @@ #!/bin/bash # rust create_release -# v0.2.2 +# v0.3.0 STAR_LINE='****************************************' CWD=$(pwd) @@ -50,9 +50,7 @@ update_patch () { # Get the url of the github repo, strip .git from the end of it get_git_remote_url() { - REMOTE_ORIGIN=$(git config --get remote.origin.url) - TO_REMOVE=".git" - GIT_REPO_URL="${REMOTE_ORIGIN//$TO_REMOVE}" + GIT_REPO_URL="$(git config --get remote.origin.url | sed 's/\.git$//')" } # Check that git status is clean @@ -121,7 +119,7 @@ update_version_number_in_files () { # create new semver version based on user input # Set MAJOR MINOR PATCH check_tag () { - LATEST_TAG=$(git describe --tags --abbrev=0 --always) + LATEST_TAG=$(git describe --tags "$(git rev-list --tags --max-count=1)") echo -e "\nCurrent tag: ${PURPLE}${LATEST_TAG}${RESET}\n" echo -e "${YELLOW}Choose new tag version:${RESET}\n" if [[ $LATEST_TAG =~ ^v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-((0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*)(\.(0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*))*))?(\+([0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)*))?$ ]]