@@ -4,20 +4,45 @@ LATEST_TAG=$1
4
4
NEXT_TAG=$2
5
5
LATEST_DATE=$( echo ${LATEST_TAG} | sed ' s/.*-//' )
6
6
NEXT_DATE=$( echo ${NEXT_TAG} | sed ' s/.*-//' )
7
+ latest_chart_app_version=$( find . \( -type d -name .git -prune \) -o -type f -name ' Chart.yaml' -print0 | xargs -0 cat | grep ^appVersion | cut -d ' :' -f 2 | tr -d ' [:space:]' )
7
8
8
9
echo -e " \033[0;32m Updating tag displayed in docs and files...\033[0m"
9
10
echo -e " \033[0;32m LATEST_TAG -> ${LATEST_TAG} \033[0m"
10
11
echo -e " \033[0;32m NEXT_TAG -> ${NEXT_TAG} \033[0m"
11
12
12
13
# If you want to test this locally and you are using macOS, do `brew install gnu-sed` and change `sed` for `gsed`.
13
- find . \( -type d -name .git -prune \) -o -type f ! -name ' Chart.yaml ' -print0 | xargs -0 sed -i " s/${LATEST_TAG} /${NEXT_TAG} /g"
14
+ find . \( -type d -name .git -prune \) -o -type f -print0 | xargs -0 sed -i " s/${LATEST_TAG} /${NEXT_TAG} /g"
14
15
15
16
echo -e " \033[0;32m Updating date used in some docs and files...\033[0m"
16
17
echo -e " \033[0;32m LATEST_DATE -> ${LATEST_DATE} \033[0m"
17
18
echo -e " \033[0;32m NEXT_DATE -> ${NEXT_DATE} \033[0m"
18
19
19
20
# If you want to test this locally and you are using macOS, do `brew install gnu-sed` and change `sed` for `gsed`.
20
- find . \( -type d -name .git -prune \) -o -type f ! -name ' Chart.yaml' -print0 | xargs -0 sed -i " s/${LATEST_DATE} /${NEXT_DATE} /g"
21
+ find . \( -type d -name .git -prune \) -o -type f -print0 | xargs -0 sed -i " s/${LATEST_DATE} /${NEXT_DATE} /g"
22
+
23
+ # Bump chart version and appVersion if next tag is different
24
+ if [ " $latest_chart_app_version " == $LATEST_TAG ] && [ " $latest_chart_app_version " != " $NEXT_TAG " ]; then
25
+ IFS=' .' read -ra latest_version_parts <<< " $LATEST_TAG"
26
+ IFS=' .' read -ra next_version_parts <<< " $NEXT_TAG"
27
+ latest_chart_version=$( find . \( -type d -name .git -prune \) -o -type f -name ' Chart.yaml' -print0 | xargs -0 cat | grep ^version | cut -d ' :' -f 2 | tr -d ' [:space:]' )
28
+ IFS=' .' read -ra latest_chart_version_parts <<< " $latest_chart_version"
29
+ if [ " ${latest_version_parts[0]} " != " ${next_version_parts[0]} " ]; then
30
+ (( latest_chart_version_parts[0 ]++ ))
31
+ latest_chart_version_parts[1]=0
32
+ latest_chart_version_parts[2]=0
33
+ elif [ " ${latest_version_parts[1]} " != " ${next_version_parts[1]} " ]; then
34
+ (( latest_chart_version_parts[1 ]++ ))
35
+ latest_chart_version_parts[2]=0
36
+ elif [ " ${latest_version_parts[2]} " != " ${next_version_parts[2]} " ]; then
37
+ (( latest_chart_version_parts[2 ]++ ))
38
+ fi
39
+ next_chart_version=" ${latest_chart_version_parts[0]} .${latest_chart_version_parts[1]} .${latest_chart_version_parts[2]} "
40
+ echo -e " \033[0;32m Updating chart version...\033[0m"
41
+ echo -e " \033[0;32m LATEST_CHART_VERSION -> ${latest_chart_version} \033[0m"
42
+ echo -e " \033[0;32m NEXT_CHART_VERSION -> ${next_chart_version} \033[0m"
43
+ # If you want to test this locally and you are using macOS, do `brew install gnu-sed` and change `sed` for `gsed`.
44
+ find . \( -type d -name .git -prune \) -o -type f -name ' Chart.yaml' -print0 | xargs -0 sed -i " s/${latest_chart_version} /${next_chart_version} /g"
45
+ fi
21
46
22
47
git diff | cat
23
48
0 commit comments