Skip to content

Commit f2adfc0

Browse files
authored
change rc tag name (#500)
1 parent c572ad3 commit f2adfc0

File tree

1 file changed

+23
-14
lines changed

1 file changed

+23
-14
lines changed

generate-stackbrew-library.sh

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,20 +37,29 @@ join() {
3737

3838
extractVersion() {
3939
awk '
40-
$1 == "ENV" && /_VERSION/ {
41-
match($2, /"(.*)"/)
42-
versionStr = substr($2, RSTART + 1, RLENGTH - 2)
43-
versionStrLength = split(versionStr, versionStrArray, ".")
44-
if(versionStrLength > 3) {
45-
print versionStr
46-
} else if(versionStrLength > 2){
47-
print versionStr ".0"
48-
} else {
49-
print versionStr ".0.0"
50-
}
51-
exit
52-
}'
53-
40+
$1 == "ENV" && /_VERSION/ {
41+
match($2, /"(.*)"/)
42+
versionStr = substr($2, RSTART + 1, RLENGTH - 2)
43+
44+
# Preserve release candidate (-rcX) if present
45+
if (match(versionStr, /-rc[0-9]+$/)) {
46+
rcPart = substr(versionStr, RSTART)
47+
versionCore = substr(versionStr, 1, RSTART - 1)
48+
} else {
49+
rcPart = ""
50+
versionCore = versionStr
51+
}
52+
53+
versionStrLength = split(versionCore, versionStrArray, ".")
54+
if (versionStrLength > 3) {
55+
print versionCore rcPart
56+
} else if (versionStrLength > 2) {
57+
print versionCore ".0" rcPart
58+
} else {
59+
print versionCore ".0.0" rcPart
60+
}
61+
exit
62+
}'
5463
}
5564

5665
self="${BASH_SOURCE##*/}"

0 commit comments

Comments
 (0)