From 4cf858c2ef36ac6a3d741431d5416e848c26c92f Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Sat, 17 Dec 2022 21:03:55 +0100 Subject: [PATCH] feat(ci): add App description and docs-list to index Signed-off-by: Kjeld Schouten-Lebbing --- .github/workflows/charts-release.yaml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/.github/workflows/charts-release.yaml b/.github/workflows/charts-release.yaml index 60e8a446535..bb00ac74c01 100644 --- a/.github/workflows/charts-release.yaml +++ b/.github/workflows/charts-release.yaml @@ -97,8 +97,33 @@ jobs: rm -rf website/docs/charts/*/${chart} || : mkdir -p website/docs/charts/${train}/${chart} || echo "chart path already exists, continuing..." yes | cp -rf charts/${train}/${chart}/docs/* website/docs/charts/${train}/${chart}/ 2>/dev/null || : + + touch website/docs/charts/${train}/${chart}/index.md + echo "${chart}" >> website/docs/charts/${train}/${chart}/index.md + echo "" >> website/docs/charts/${train}/${chart}/index.md + echo "## App Description" >> website/docs/charts/${train}/${chart}/index.md + echo "" >> website/docs/charts/${train}/${chart}/index.md + cat charts/${train}/${chart}/Chart.yaml | yq .description -r >> website/docs/charts/${train}/${chart}/index.md + echo "" >> website/docs/charts/${train}/${chart}/index.md + echo "## Available Documentation" >> website/docs/charts/${train}/${chart}/index.md + echo "" >> website/docs/charts/${train}/${chart}/index.md + + # Iterate over all files in the docs directory + for file in website/docs/charts/${train}/${chart}/*; do + # Extract the file name and first line from each file + filename=$(basename "${file}") + title=$(head -n 1 "${file}" | sed 's/#//') + + # Create a markdown link using the file name and title + link="[${title}](/${filename})" + + # Append the link to the index.md file + echo "${link}" >> website/docs/charts/${train}/${chart}/index.md + done + yes | cp -f templates/docs/index.md website/docs/charts/${train}/${chart}/index.md 2>/dev/null || : sed -i "s/APPNAME/${chart}/" "website/docs/charts/${train}/${chart}/index.md" || echo "failed to add index header..." + mv -f tmp/website/docs/charts/${train}/${chart}/CHANGELOG.md website/docs/charts/${train}/${chart}/CHANGELOG.md 2>/dev/null || : yes | cp -rf charts/${train}/${chart}/icon.png website/static/img/hotlink-ok/chart-icons/${chart}.png 2>/dev/null || : # Append SCALE changelog to actual changelog