Skip to content

Commit 9eb4b92

Browse files
authored
build: add support for updating the image tag on the helm chart README.md (#271)
Signed-off-by: Niladri Halder <[email protected]>
1 parent 1c8b1e2 commit 9eb4b92

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

scripts/update-chart-version.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,14 @@ update_chart_yaml() {
138138

139139
yq_ibl ".version = \"$VERSION\" | .appVersion = \"$APP_VERSION\"" "$CHART_YAML"
140140
yq_ibl ".localpv.image.tag = \"$VERSION\"" "$VALUES_YAML"
141+
142+
if sed --version >/dev/null 2>&1; then
143+
# GNU sed
144+
sed -i "s/| \`localpv\.image\.tag\`[[:space:]]*| Image tag for LocalPV Provisioner[[:space:]]*| \`[^\\\`]*\`[[:space:]]*|/| \`localpv.image.tag\` | Image tag for LocalPV Provisioner | \`$APP_VERSION\` |/" "$README_MD"
145+
else
146+
# BSD/macOS sed
147+
sed -i '' "s/| \`localpv\.image\.tag\`[[:space:]]*| Image tag for LocalPV Provisioner[[:space:]]*| \`[^\\\`]*\`[[:space:]]*|/| \`localpv.image.tag\` | Image tag for LocalPV Provisioner | \`$APP_VERSION\` |/" "$README_MD"
148+
fi
141149
}
142150

143151
set -euo pipefail
@@ -151,6 +159,7 @@ SCRIPT_DIR="$(dirname "$(realpath "${BASH_SOURCE[0]:-"$0"}")")"
151159
ROOT_DIR="$SCRIPT_DIR/.."
152160
CHART_DIR="$ROOT_DIR/deploy/helm/charts"
153161
CHART_YAML="$CHART_DIR/Chart.yaml"
162+
README_MD="$CHART_DIR/README.md"
154163
VALUES_YAML="$CHART_DIR/values.yaml"
155164

156165
# Final computed version to be set in this.

0 commit comments

Comments
 (0)