-
Notifications
You must be signed in to change notification settings - Fork 2k
/
release-notes-update.sh
executable file
·55 lines (45 loc) · 1.21 KB
/
release-notes-update.sh
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
47
48
49
50
51
52
53
54
55
#!/usr/bin/env bash
set -o pipefail
ROOTDIR=$(git rev-parse --show-toplevel || echo ".")
TMPDIR=/tmp
DEBUG=${DEBUG:-"false"}
DOCS_TO_UPDATE_FOLDER=${ROOTDIR}/docs/content
usage() {
echo "Usage: $0 <ic_version> <helm_chart_version> <k8s_versions> <release_date>"
exit 1
}
ic_version=$1
helm_chart_version=$2
k8s_versions=$3
release_date=$4
if [ -z "${ic_version}" ]; then
usage
fi
if [ -z "${helm_chart_version}" ]; then
usage
fi
if [ -z "${k8s_versions}" ]; then
usage
fi
if [ -z "${release_date}" ]; then
usage
fi
# update releases docs
file_path=${DOCS_TO_UPDATE_FOLDER}/releases.md
if [ "${DEBUG}" != "false" ]; then
echo "Processing ${file_path}"
fi
file_name=$(basename "${file_path}")
mv "${file_path}" "${TMPDIR}/${file_name}"
sed -e "8r ${ROOTDIR}/hack/changelog-template.txt" "${TMPDIR}/${file_name}" | sed \
-e "s/%%TITLE%%/## $ic_version/g" \
-e "s/%%IC_VERSION%%/$ic_version/g" \
-e "s/%%HELM_CHART_VERSION%%/$helm_chart_version/g" \
-e "s/%%K8S_VERSIONS%%/$k8s_versions.\n/g" \
-e "s/%%RELEASE_DATE%%/$release_date/g" \
> ${file_path}
if [ $? -ne 0 ]; then
echo "ERROR: failed processing ${file_path}"
mv "${TMPDIR}/${file_name}" "${file_path}"
exit 2
fi