Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save tyagiakhilesh/74d19144aa17179db6a88b0a1d07434c to your computer and use it in GitHub Desktop.
Save tyagiakhilesh/74d19144aa17179db6a88b0a1d07434c to your computer and use it in GitHub Desktop.
#!/bin/bash
set -x
mvn_cmd_to_get_version() {
mvn help:evaluate -Dexpression=project.version
}
get_current_version() {
output=$(mvn_cmd_to_get_version);
result=$(echo "$output" | grep -v '\[.*');
echo $result
}
current_version=$(get_current_version)
echo "$current_version"
suffix="$(echo $current_version | cut -d \- -f 2)"
echo $suffix
prefix="$(echo $current_version | cut -d \- -f 1)"
echo $prefix
version="$prefix-$BRANCH-$suffix"
echo "New version value is: $version"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment