From 9a85dee993ec8676f699d5e11b887d34f85fa0a9 Mon Sep 17 00:00:00 2001 From: Stavros Kois <47820033+stavros-k@users.noreply.github.com> Date: Fri, 29 Jul 2022 03:17:37 +0300 Subject: [PATCH] feat(ci): Auto add/update/replace `sources` with TC git repo link (#3336) * no need to quote the link * auto add/replace/update source with tc git repo link --- .github/scripts/gen-docs.sh | 12 +++++++++++- tools/build-release.sh | 12 +++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/.github/scripts/gen-docs.sh b/.github/scripts/gen-docs.sh index 1440ec8541d..cbd1d957d4d 100755 --- a/.github/scripts/gen-docs.sh +++ b/.github/scripts/gen-docs.sh @@ -27,7 +27,17 @@ sync_tag() { tag="${tag%_}" tag="${tag%.}" sed -i -e "s|appVersion: .*|appVersion: \"${tag}\"|" "${chart}/Chart.yaml" - sed -i -e "s|home: .*|home: \"https:\/\/truecharts.org\/docs\/charts\/${train}\/${chartname}\"|" "${chart}/Chart.yaml" + sed -i -e "s|home: .*|home: https:\/\/truecharts.org\/docs\/charts\/${train}\/${chartname}|" "${chart}/Chart.yaml" + # Get all sources (except truecharts) + curr_sources=$(yq '.sources[] | select(. != "https://github.com/truecharts*")' "${chart}/Chart.yaml") + # Empty sources list in-place + yq -i 'del(.sources.[])' "${chart}/Chart.yaml" + # Add truechart source + tcsource="https://github.com/truecharts/charts/tree/master/charts/$train/$chartname" yq -i '.sources += env(tcsource)' "${chart}/Chart.yaml" + # Add the rest of the sources + while IFS= read -r line; do + src="$line" yq -i '.sources += env(src)' "${chart}/Chart.yaml" + done <<< "$curr_sources" } export -f sync_tag diff --git a/tools/build-release.sh b/tools/build-release.sh index 4c7c00799bb..b80e4aef3e2 100755 --- a/tools/build-release.sh +++ b/tools/build-release.sh @@ -296,7 +296,17 @@ sync_tag() { tag="${tag%_}" tag="${tag%.}" sed -i -e "s|appVersion: .*|appVersion: \"${tag}\"|" "${chart}/Chart.yaml" - sed -i -e "s|home: .*|home: \"https:\/\/truecharts.org\/docs\/charts\/${train}\/${chartname}\"|" "${chart}/Chart.yaml" + sed -i -e "s|home: .*|home: https:\/\/truecharts.org\/docs\/charts\/${train}\/${chartname}|" "${chart}/Chart.yaml" + # Get all sources (except truecharts) + curr_sources=$(yq '.sources[] | select(. != "https://github.com/truecharts*")' "${chart}/Chart.yaml") + # Empty sources list in-place + yq -i 'del(.sources.[])' "${chart}/Chart.yaml" + # Add truechart source + tcsource="https://github.com/truecharts/charts/tree/master/charts/$train/$chartname" yq -i '.sources += env(tcsource)' "${chart}/Chart.yaml" + # Add the rest of the sources + while IFS= read -r line; do + src="$line" yq -i '.sources += env(src)' "${chart}/Chart.yaml" + done <<< "$curr_sources" } export -f sync_tag