You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: hack/bump-charts.sh
+12-1Lines changed: 12 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -21,4 +21,15 @@ TO_MINOR="${3:?TO_MINOR (3rd arg) not set or empty}"
21
21
# example usage: hack/bump-release.sh 28 28 1
22
22
# should replace 1.28.x with 1.28.1 / 2.28.x with 2.28.1
23
23
24
-
find charts -type f -exec sed -i -re 's/((ersion)?: ?v?)?([1-2]\.)'${FROM_MAJOR}'\.([0-9][0-9a-zA-Z.-]*)/\1\3'${TO_MAJOR}'.'${TO_MINOR}'/g'"{}"\;
24
+
# Use portable sed syntax that works on both Linux (GNU sed) and macOS (BSD sed)
25
+
if sed --version >/dev/null 2>&1;then
26
+
# GNU sed (Linux)
27
+
SED_INPLACE=(-i)
28
+
SED_EXTENDED=(-r)
29
+
else
30
+
# BSD sed (macOS)
31
+
SED_INPLACE=(-i '')
32
+
SED_EXTENDED=(-E)
33
+
fi
34
+
35
+
find charts -type f -exec sed "${SED_INPLACE[@]}""${SED_EXTENDED[@]}" -e 's/((ersion)?: ?v?)?([1-2]\.)'${FROM_MAJOR}'\.([0-9][0-9a-zA-Z.-]*)/\1\3'${TO_MAJOR}'.'${TO_MINOR}'/g'"{}"\;
0 commit comments