Skip to content

Instantly share code, notes, and snippets.

@turing85
Last active September 22, 2023 22:45
Show Gist options
  • Save turing85/e2a1c44213376abd1e1cfc7b21230846 to your computer and use it in GitHub Desktop.
Save turing85/e2a1c44213376abd1e1cfc7b21230846 to your computer and use it in GitHub Desktop.
increment versions
function next_release_version() {
local current_version="${1}"
local first_part
first_part=$(echo "${current_version}" | sed -e 's/^\(.*\)\([[:digit:]]\+\)[^\.]*$/\1/g')
local last_digit
last_digit=$(echo "${current_version}" | sed -e 's/^\(.*\)\([[:digit:]]\+\)[^\.]*$/\2/g')
echo "${first_part}$((last_digit+1))"
}
function next_snapshot_version() {
echo "$(next_release_version "${1}")-SNAPSHOT"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment