-
-
Notifications
You must be signed in to change notification settings - Fork 56
Expand file tree
/
Copy pathrenovate-update-chart-dependency.sh
More file actions
executable file
·46 lines (37 loc) · 1.27 KB
/
Copy pathrenovate-update-chart-dependency.sh
File metadata and controls
executable file
·46 lines (37 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/bash
set -o pipefail
[[ "${#}" == "4" ]] || {
echo "Please give the chart name, the update type, dependency name and the new version of the dependency as only arguments"
exit 3
}
CHART="$1"
UPDATE_TYPE="$2"
DEP_NAME="$3"
DEP_VERSION_NEW="$4"
version="$(awk '/^version:/ {print $2}' "charts/${CHART}/Chart.yaml")"
echo "Old version is ${version}"
major="$(echo "${version}" | cut -d. -f1)"
minor="$(echo "${version}" | cut -d. -f2)"
patch="$(echo "${version}" | cut -d. -f3)"
if [[ "${UPDATE_TYPE}" =~ (major|replacement) ]]
then
major="$(( major + 1 ))"
minor=0
patch=0
elif [[ "${UPDATE_TYPE}" =~ 'minor' ]]
then
minor="$(( minor + 1 ))"
patch=0
else
# We do not need to bump the patch version as this happened already beforehand by Renovate
patch="$(( patch ))"
fi
NEW_VERSION="${major}.${minor}.${patch}"
echo "New version is ${NEW_VERSION}"
# change version in Chart.yaml
sed -i "s/^version:.*/version: ${NEW_VERSION}/g" "charts/${CHART}/Chart.yaml"
# replace changes annotation for artifacthub in Chart.yaml
changes=$"- kind: changed\n description: dependency of ${DEP_NAME} to ${DEP_VERSION_NEW}\n"
yq eval ".annotations.\"artifacthub.io/changes\" = \"${changes}\"" -i charts/${CHART}/Chart.yaml
# update CHANGELOG.md
.github/generate-chart-changelogs.sh