@@ -81,50 +81,34 @@ jobs:
8181 file_minor=$(echo "$file_release_version" | cut -d'.' -f2)
8282 file_patch=$(echo "$file_release_version" | cut -d'.' -f3)
8383
84-
8584 input_major=$(echo "$input_release_version" | cut -d'.' -f1)
8685 input_minor=$(echo "$input_release_version" | cut -d'.' -f2)
8786 input_patch=$(echo "$input_release_version" | cut -d'.' -f3)
8887
89- max_major=$(("$file_major" + 1))
90- max_minor=$(("$file_minor" + 1))
91- max_patch=$(("$file_patch" + 1))
92-
93- echo "max versions: $max_major.$max_minor.$max_patch"
94-
95-
96- if [ "$input_major" -gt "$max_major" ]; then
97- echo "Error: Major version cannot be greater than the current version by more than 1."
98- exit 1
99- elif [ "$input_minor" -gt "$max_minor" ]; then
100- echo "Error: Minor version cannot be greater than the current version by more than 1."
101- exit 1
102- elif [ "$input_patch" -gt "$max_patch" ]; then
103- echo "Error: Patch version cannot be greater than the current version by more than 1."
104- exit 1
105- elif [ "$input_major" -lt "$file_major" ]; then
106- echo "Error: Major version cannot be less than the current version."
107- exit 1
108- elif [ "$input_minor" -lt "$file_minor" ]; then
109- if [ "$input_major" -eq "$max_major" ] && [ "$input_minor" -eq 0 ] && [ "$input_patch" -eq 0 ]; then
110- echo "Valid version input"
88+ if [ "$input_major" -eq "$file_major" ]; then
89+ if [ "$input_minor" -eq "$file_minor" ]; then
90+ if [ "$input_patch" -gt "$file_patch" ]; then
91+ echo "Valid patch version input"
92+ else
93+ echo "Error: Patch version cannot be less than or equal to the current version."
94+ exit 1
95+ fi
96+ elif [ "$input_minor" -gt "$file_minor" ] && [ "$input_patch" -eq 0 ]; then
97+ echo "Valid minor version input"
11198 else
112- echo "Error: Minor version cannot be less than the current version."
113- exit 1
114- fi
115- elif [ "$input_patch" -lt "$file_patch" ]; then
116- if [ "$input_major" -eq "$max_major" ] && [ "$input_minor" -eq 0 ] && [ "$input_patch" -eq 0 ]; then
117- echo "Valid version input"
118- elif [ "$input_major" -eq "$file_major" ] && [ "$input_minor" -eq "$max_minor" ] && [ "$input_patch" -eq 0 ]; then
119- echo "Valid version input"
120- else
121- echo "Error: Patch version cannot be less than the current version."
99+ echo "Error: Minor version is invalid."
122100 exit 1
123101 fi
102+ elif [ "$input_major" -gt "$file_major" ] && [ "$input_minor" -eq 0 ] && [ "$input_patch" -eq 0 ]; then
103+ echo "Valid major version input"
104+ else
105+ echo "Error: Version input is invalid based on semantic versioning rules."
106+ exit 1
124107 fi
108+
125109 echo "New version is $input_major.$input_minor.$input_patch"
126110 echo "RELEASE_VERSION=$input_release_version" >> "$GITHUB_ENV"
127-
111+
128112 - name : create release branch
129113 run : |
130114 git config user.name "$GITHUB_ACTOR"
0 commit comments