File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11#! /bin/bash
22
3+ PACKAGE_NAME=GRAPH_IMPORTER_VERSION
4+
5+ # Check if VERSIONS_FILE_PATH is not set or empty
6+ if [ -z " ${VERSIONS_FILE_PATH} " ]; then
7+ echo " Error: Please define \$ {VERSIONS_FILE_PATH} in the GO-CD environment or in the server."
8+ exit 1
9+ fi
10+
311# Get the current version from Maven
412current_version=$( mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
513echo " Current version: $current_version "
614
15+
716# Extract major, minor, and patch versions
8- major=${current_version%% .* }
9- rest=${current_version#* .}
10- minor=${rest%% .* }
11- patch=${rest#* .}
17+ major=${current_version%% .* }
18+ rest=${current_version#* .}
19+ minor=${rest%% .* }
20+ patch=${rest#* .}
21+
1222
1323# Increment the minor version
1424new_minor=$(( minor + 1 ))
1525new_version=" ${major} .${new_minor} .0"
16-
1726# Output the new version
1827echo " New version: $new_version "
19-
2028# Set the new version in Maven
2129mvn versions:set -DnewVersion=$new_version
30+
31+
32+
33+ if grep -q " ^${PACKAGE_NAME} =" /var/go/versions.properties; then
34+ sed -i " s/^${PACKAGE_NAME} =.*/${PACKAGE_NAME} =${new_version} /" " ${VERSIONS_FILE_PATH} "
35+ else
36+ echo " ${PACKAGE_NAME} =${new_version} " >> " ${VERSIONS_FILE_PATH} "
37+ fi
You can’t perform that action at this time.
0 commit comments