File tree Expand file tree Collapse file tree 1 file changed +23
-5
lines changed Expand file tree Collapse file tree 1 file changed +23
-5
lines changed Original file line number Diff line number Diff line change 1414
1515# jar was downloaded from here https://repo1.maven.org/maven2/io/swagger/codegen/v3/swagger-codegen-cli/3.0.34/
1616
17- if [[ $VERSION == * " develop" * ]]; then
18- SANITIZED_VERSION=$( sed ' s/-develop//g' <<< $VERSION )
19- SANITIZED_VERSION=$( sed ' s/\.[0-9]*$//g' <<< $SANITIZED_VERSION )
20- BUILD_VERSION=$( grep -o ' [0-9]*$' <<< $VERSION )
21- VERSION=" dev-$SANITIZED_VERSION -$BUILD_VERSION "
17+ VERSION=${VERSION// develop/ dev}
18+
19+ if [[ $VERSION =~ ^dev[.-]([0-9]+)[.-]([0-9]+)[.-]([0-9]+)[.-]([0-9]+)$ ]]; then
20+ # Example for the regex above:
21+ # dev.1.0.0.0
22+ # dev-1.0.0-0
23+ # dev.1.0.0-0
24+ # dev-1.0.0.0
25+ VERSION=" ${BASH_REMATCH[1]} .${BASH_REMATCH[2]} .${BASH_REMATCH[3]} -beta.${BASH_REMATCH[4]} "
26+ elif [[ $VERSION =~ ^([0-9]+)[.-]([0-9]+)[.-]([0-9]+)[.-]dev[.-]([0-9]+)$ ]]; then
27+ # Example for the regex above:
28+ # 1.0.0.dev.0
29+ # 1.0.0.dev-0
30+ # 1.0.0-dev-0
31+ # 1.0.0-dev.0
32+ VERSION=" ${BASH_REMATCH[1]} .${BASH_REMATCH[2]} .${BASH_REMATCH[3]} -beta.${BASH_REMATCH[4]} "
33+ elif [[ $VERSION == dev-* ]]; then
34+ _temp_part=${VERSION# dev-}
35+ VERSION=" ${_temp_part// -/ .} -beta"
36+ elif [[ $VERSION == * -dev* ]]; then
37+ _temp_part=${VERSION#* -dev}
38+ _temp_part=${_temp_part// -/ .}
39+ VERSION=" ${VERSION%% -dev* } -beta$_temp_part "
2240fi
2341
2442echo " VERSION: $VERSION "
You can’t perform that action at this time.
0 commit comments