From e92fd316b0aef268a7cc629354e7cc9eed4e5596 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=E1=B4=87=CA=80=C9=B4=E1=B4=85=20S=E1=B4=84=CA=9C?= =?UTF-8?q?=E1=B4=8F=CA=80=C9=A2=E1=B4=87=CA=80s?= Date: Tue, 29 Mar 2022 12:26:05 +0200 Subject: [PATCH] ci: Update Renovate releasenotes script --- .github/scripts/renovate-releasenotes.sh | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/.github/scripts/renovate-releasenotes.sh b/.github/scripts/renovate-releasenotes.sh index 834018b3..0c293fd2 100755 --- a/.github/scripts/renovate-releasenotes.sh +++ b/.github/scripts/renovate-releasenotes.sh @@ -19,7 +19,7 @@ if [ $# -ge 1 ] && [ -n "$1" ]; then printf >&2 "File %s does not exist.\n" "${chart_file}" exit 1 fi - cd $root + cd "${root}" if [ -z "$DEFAULT_BRANCH" ]; then DEFAULT_BRANCH=$(git remote show origin | awk '/HEAD branch/ {print $NF}') @@ -28,23 +28,24 @@ if [ $# -ge 1 ] && [ -n "$1" ]; then printf "Updating changelog annotation for chart %s\n" "$root" # Loop over all dependencies in current chart version - NEW_DEPENDENCIES=$(cat Chart.yaml | yq e '.dependencies[].name' -P - | LC_ALL=C sort) - OLD_DEPENDENCIES=$(git show origin/$DEFAULT_BRANCH:./Chart.yaml | yq e '.dependencies[].name' -P - | LC_ALL=C sort) + NEW_DEPENDENCIES=() + while IFS='' read -r line; do NEW_DEPENDENCIES+=("$line"); done < <(yq e '.dependencies[].name' -P Chart.yaml | LC_ALL=C sort) + OLD_DEPENDENCIES=$(git show "origin/$DEFAULT_BRANCH:./Chart.yaml" | yq e '.dependencies[].name' -P - | LC_ALL=C sort) tmpfile=$(mktemp) trap 'rm -f "$tmpfile"' EXIT - for DEP_NAME in ${NEW_DEPENDENCIES[@]} + for DEP_NAME in "${NEW_DEPENDENCIES[@]}" do - NEW_VERSION=$(cat Chart.yaml | yq e ".dependencies[] | select(.name == \"$DEP_NAME\") | .version" -P -) - OLD_VERSION=$(git show origin/$DEFAULT_BRANCH:./Chart.yaml | yq e ".dependencies[] | select(.name == \"$DEP_NAME\") | .version" -P -) + NEW_VERSION=$(yq e ".dependencies[] | select(.name == \"$DEP_NAME\") | .version" -P Chart.yaml) + OLD_VERSION=$(git show "origin/$DEFAULT_BRANCH:./Chart.yaml" | yq e ".dependencies[] | select(.name == \"$DEP_NAME\") | .version" -P -) if [ "${NEW_VERSION}" != "${OLD_VERSION}" ]; then - printf "%s\n" "- kind: changed" >> $tmpfile - printf " description: Upgraded \`%s\` chart dependency to version \`%s\`.\n" "${DEP_NAME}" "${NEW_VERSION}" >> $tmpfile + printf "%s\n" "- kind: changed" >> "${tmpfile}" + printf " description: Upgraded \`%s\` chart dependency to version \`%s\`.\n" "${DEP_NAME}" "${NEW_VERSION}" >> "${tmpfile}" fi done - yq eval-all --inplace 'select(fileIndex == 0).annotations."artifacthub.io/changes" = (select(fileIndex == 1) | to_yaml) | select(fileIndex==0)' Chart.yaml $tmpfile + yq eval-all --inplace 'select(fileIndex == 0).annotations."artifacthub.io/changes" = (select(fileIndex == 1) | to_yaml) | select(fileIndex==0)' Chart.yaml "${tmpfile}" else printf >&2 "%s\n" "No chart folder has been specified." exit 1