2022-03-30 10:26:37 +00:00
|
|
|
name: "Charts: Release"
|
|
|
|
|
|
|
|
concurrency: helm-release
|
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
paths:
|
|
|
|
- "charts/**"
|
|
|
|
|
|
|
|
jobs:
|
2022-09-22 12:54:25 +00:00
|
|
|
release-scale:
|
2022-03-30 10:26:37 +00:00
|
|
|
runs-on: ubuntu-latest
|
2022-11-10 09:06:50 +00:00
|
|
|
outputs:
|
|
|
|
ref: ${{ steps.save-commit-hash.outputs.commit_hash }}
|
2022-03-30 10:26:37 +00:00
|
|
|
container:
|
2022-11-30 19:28:27 +00:00
|
|
|
image: ghcr.io/truecharts/devcontainer:v3.1.1@sha256:f0ecaa533663f88346b745eb497f6f6acf63561ad88e345cd71c8280963b8c1e
|
2022-03-30 10:26:37 +00:00
|
|
|
steps:
|
|
|
|
- name: Install Kubernetes tools
|
2022-11-03 08:43:41 +00:00
|
|
|
uses: yokawasa/action-setup-kube-tools@b91bb02bc122bd84ac7bbea5f25ed6b0f2ec6275 # tag=v0.9.2
|
2022-03-30 10:26:37 +00:00
|
|
|
with:
|
2022-03-30 12:59:33 +00:00
|
|
|
setup-tools: |
|
|
|
|
helmv3
|
|
|
|
helm: "3.8.0"
|
2022-03-30 10:26:37 +00:00
|
|
|
|
2022-04-01 09:45:11 +00:00
|
|
|
- name: Prep Helm
|
|
|
|
run: |
|
|
|
|
helm repo add truecharts https://charts.truecharts.org
|
|
|
|
helm repo add truecharts-library https://library-charts.truecharts.org
|
|
|
|
helm repo add bitnami https://charts.bitnami.com/bitnami
|
2022-11-10 15:46:44 +00:00
|
|
|
|
2022-04-01 09:45:11 +00:00
|
|
|
helm repo add prometheus https://prometheus-community.github.io/helm-charts
|
|
|
|
helm repo update
|
|
|
|
|
2022-04-01 09:03:57 +00:00
|
|
|
- name: Checkout
|
2022-12-13 15:30:19 +00:00
|
|
|
uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3
|
2022-04-01 09:03:57 +00:00
|
|
|
with:
|
|
|
|
token: ${{ secrets.BOT_TOKEN }}
|
2022-04-01 10:31:10 +00:00
|
|
|
fetch-depth: 0
|
2022-04-01 07:52:38 +00:00
|
|
|
|
2022-11-24 10:26:33 +00:00
|
|
|
- name: Setting repo parent dir as safe safe.directory
|
|
|
|
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
|
|
|
|
|
2022-04-01 07:52:38 +00:00
|
|
|
- name: Collect changes
|
|
|
|
id: collect-changes
|
|
|
|
uses: ./.github/actions/collect-changes
|
|
|
|
|
2022-11-10 19:39:03 +00:00
|
|
|
- name: Generate Changelog
|
2022-04-01 09:34:46 +00:00
|
|
|
shell: bash
|
2022-04-01 09:32:27 +00:00
|
|
|
if: |
|
|
|
|
steps.collect-changes.outputs.changesDetectedAfterTag == 'true'
|
2022-04-01 09:03:57 +00:00
|
|
|
run: |
|
2022-04-01 09:32:27 +00:00
|
|
|
CHARTS=(${{ steps.collect-changes.outputs.modifiedChartsAfterTag }})
|
2022-04-03 08:43:00 +00:00
|
|
|
parthreads=$(($(nproc) * 2))
|
2022-11-10 19:39:03 +00:00
|
|
|
parallel -j ${parthreads} .github/scripts/changelog.sh '2>&1' ::: ${CHARTS[@]}
|
2022-04-03 08:43:00 +00:00
|
|
|
|
2022-04-01 09:45:11 +00:00
|
|
|
- name: Fix Pre-Commit issues
|
|
|
|
shell: bash
|
|
|
|
if: |
|
|
|
|
steps.collect-changes.outputs.changesDetectedAfterTag == 'true'
|
|
|
|
run: |
|
|
|
|
echo "Running pre-commit test-and-cleanup..."
|
|
|
|
pre-commit run --all ||:
|
|
|
|
# Fix sh files to always be executable
|
|
|
|
find . -name '*.sh' | xargs chmod +x
|
|
|
|
|
2022-04-01 06:39:13 +00:00
|
|
|
- name: Checkout
|
2022-12-13 15:30:19 +00:00
|
|
|
uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3
|
2022-04-03 15:15:08 +00:00
|
|
|
if: |
|
|
|
|
steps.collect-changes.outputs.changesDetectedAfterTag == 'true'
|
2022-04-01 06:39:13 +00:00
|
|
|
with:
|
|
|
|
fetch-depth: 1
|
2022-07-12 20:38:48 +00:00
|
|
|
repository: truecharts/website
|
2022-04-01 06:39:13 +00:00
|
|
|
token: ${{ secrets.BOT_TOKEN }}
|
2022-07-12 20:38:48 +00:00
|
|
|
path: website
|
2022-04-01 07:52:38 +00:00
|
|
|
|
2022-04-01 06:34:12 +00:00
|
|
|
- name: Copy docs to website
|
|
|
|
if: |
|
2022-04-01 08:57:40 +00:00
|
|
|
steps.collect-changes.outputs.changesDetectedAfterTag == 'true'
|
2022-04-01 07:27:52 +00:00
|
|
|
shell: bash
|
2022-04-01 06:34:12 +00:00
|
|
|
run: |
|
2022-04-01 07:17:25 +00:00
|
|
|
#!/bin/bash
|
2022-04-01 08:57:40 +00:00
|
|
|
CHARTS=(${{ steps.collect-changes.outputs.modifiedChartsAfterTag }})
|
2022-07-12 22:05:07 +00:00
|
|
|
echo "Removing Chart Docs prior to regeneration..."
|
2022-08-01 20:54:37 +00:00
|
|
|
mkdir -p website/static/img/hotlink-ok/chart-icons || echo "chart-icons path already exists, continuing..."
|
2022-04-01 06:56:49 +00:00
|
|
|
for i in "${CHARTS[@]}"
|
|
|
|
do
|
|
|
|
IFS='/' read -r -a chart_parts <<< "$i"
|
|
|
|
if [ -f "charts/${chart_parts[0]}"/"${chart_parts[1]}/Chart.yaml" ]; then
|
|
|
|
train=${chart_parts[0]}
|
|
|
|
chart=${chart_parts[1]}
|
|
|
|
echo "copying docs to website for ${chart}"
|
2022-12-22 16:19:31 +00:00
|
|
|
mkdir -p website/docs/charts/${train}/${chart} || echo "chart path already exists, continuing..."
|
2022-11-10 20:44:54 +00:00
|
|
|
mkdir -p tmp/website/docs/charts/${train}/${chart}/ || echo "chart path already exists, continuing..."
|
2022-12-18 20:39:57 +00:00
|
|
|
if [[ -f "website/docs/charts/${train}/${chart}/CHANGELOG.md" ]]; then
|
|
|
|
echo "changelog found..."
|
|
|
|
true
|
|
|
|
else
|
|
|
|
echo "changelog not found, starting with empty changelog..."
|
|
|
|
touch "website/docs/charts/${train}/${chart}/CHANGELOG.md"
|
|
|
|
fi
|
2022-12-21 21:55:18 +00:00
|
|
|
if [[ -f "website/docs/charts/${train}/${chart}/helm-security.md" ]]; then
|
|
|
|
echo "helm-security found..."
|
|
|
|
true
|
|
|
|
else
|
|
|
|
echo "helm-security not found, starting with empty helm-security..."
|
|
|
|
touch "website/docs/charts/${train}/${chart}/helm-security.md"
|
2022-12-23 11:10:57 +00:00
|
|
|
echo "# Helm Security" >> website/docs/charts/${train}/${chart}/helm-security.md
|
2022-12-21 21:55:18 +00:00
|
|
|
fi
|
|
|
|
if [[ -f "website/docs/charts/${train}/${chart}/container-security.md" ]]; then
|
|
|
|
echo "container-security found..."
|
|
|
|
true
|
|
|
|
else
|
|
|
|
echo "container-security not found, starting with empty container-security..."
|
|
|
|
touch "website/docs/charts/${train}/${chart}/container-security.md"
|
2022-12-23 11:10:57 +00:00
|
|
|
echo "# Helm Security" >> website/docs/charts/${train}/${chart}/container-security.md
|
2022-12-21 21:55:18 +00:00
|
|
|
fi
|
|
|
|
# keep some docs safe
|
2022-11-10 21:44:16 +00:00
|
|
|
mv -f website/docs/charts/${train}/${chart}/CHANGELOG.md tmp/website/docs/charts/${train}/${chart}/CHANGELOG.md || :
|
2022-12-21 22:13:59 +00:00
|
|
|
mv -f website/docs/charts/${train}/${chart}/helm-security.md tmp/website/docs/charts/${train}/${chart}/helm-security.md || :
|
2022-12-21 22:03:18 +00:00
|
|
|
mv -f website/docs/charts/${train}/${chart}/container-security.md tmp/website/docs/charts/${train}/${chart}/container-security.md || :
|
2022-12-21 21:55:18 +00:00
|
|
|
|
|
|
|
# remove old docs everywhere and recreate based on charts repo
|
2022-11-10 20:44:54 +00:00
|
|
|
rm -rf website/docs/charts/*/${chart} || :
|
2022-07-12 20:38:48 +00:00
|
|
|
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 || :
|
2022-12-21 21:55:18 +00:00
|
|
|
yes | cp -rf charts/${train}/${chart}/icon.png website/static/img/hotlink-ok/chart-icons/${chart}.png 2>/dev/null || :
|
|
|
|
|
|
|
|
# Copy over kept documents
|
|
|
|
mv -f tmp/website/docs/charts/${train}/${chart}/CHANGELOG.md website/docs/charts/${train}/${chart}/CHANGELOG.md 2>/dev/null || :
|
2022-12-21 22:03:18 +00:00
|
|
|
mv -f tmp/website/docs/charts/${train}/${chart}/helm-security.md website/docs/charts/${train}/${chart}/helm-security.md 2>/dev/null || :
|
|
|
|
mv -f tmp/website/docs/charts/${train}/${chart}/container-security.md website/docs/charts/${train}/${chart}/container-security.md 2>/dev/null || :
|
2022-12-21 21:55:18 +00:00
|
|
|
|
|
|
|
# Append SCALE changelog to actual changelog
|
|
|
|
sed -i '1d' "website/docs/charts/${train}/${chart}/CHANGELOG.md" || echo "failed to sed 1d changelog..."
|
|
|
|
cat "charts/${train}/${chart}/app-changelog.md" | cat - "website/docs/charts/${train}/${chart}/CHANGELOG.md" > temp && mv temp "website/docs/charts/${train}/${chart}/CHANGELOG.md"
|
|
|
|
sed -i '1s/^/# Changelog\n\n/' "website/docs/charts/${train}/${chart}/CHANGELOG.md" || echo "failed to add changelog header..."
|
2022-12-18 20:29:53 +00:00
|
|
|
|
2022-12-17 20:03:55 +00:00
|
|
|
touch website/docs/charts/${train}/${chart}/index.md
|
2022-12-17 20:07:43 +00:00
|
|
|
echo "# ${chart}" >> website/docs/charts/${train}/${chart}/index.md
|
2022-12-17 20:03:55 +00:00
|
|
|
echo "" >> website/docs/charts/${train}/${chart}/index.md
|
2022-12-21 21:44:24 +00:00
|
|
|
version=$(cat charts/${train}/${chart}/Chart.yaml | grep "^version: " | awk -F" " '{ print $2 }')
|
|
|
|
appversion=$(cat charts/${train}/${chart}/Chart.yaml | grep "^appVersion: " | awk -F" " '{ print $2 }')
|
|
|
|
echo '![Version: '"${version}"'](https://img.shields.io/badge/Version-'"${version}"'-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: '"${appversion}"'](https://img.shields.io/badge/AppVersion-'"${appversion}"'-informational?style=flat-square)' >> website/docs/charts/${train}/${chart}/index.md
|
2022-12-17 20:03:55 +00:00
|
|
|
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
|
2022-12-18 20:29:53 +00:00
|
|
|
|
2022-12-17 20:03:55 +00:00
|
|
|
# Iterate over all files in the docs directory
|
2022-12-18 20:29:53 +00:00
|
|
|
for file in website/docs/charts/${train}/${chart}/*.md; do
|
2022-12-17 20:03:55 +00:00
|
|
|
# Extract the file name and first line from each file
|
|
|
|
filename=$(basename "${file}")
|
2022-12-17 20:28:43 +00:00
|
|
|
title=$(head -n 1 "${file}" | sed 's/# //')
|
2022-12-18 20:29:53 +00:00
|
|
|
|
2022-12-17 20:03:55 +00:00
|
|
|
# Create a markdown link using the file name and title
|
2022-12-21 22:58:16 +00:00
|
|
|
link="[**${title}**](${filename%.md})"
|
2022-12-17 21:55:57 +00:00
|
|
|
if [ ${filename} != "index.md" ]; then
|
|
|
|
# Append the link to the index.md file
|
2022-12-21 22:05:13 +00:00
|
|
|
echo "- ${link}" >> website/docs/charts/${train}/${chart}/index.md
|
2022-12-19 22:20:06 +00:00
|
|
|
echo "" >> website/docs/charts/${train}/${chart}/index.md
|
2022-12-17 21:55:57 +00:00
|
|
|
fi
|
2022-12-17 20:03:55 +00:00
|
|
|
done
|
2022-12-18 20:29:53 +00:00
|
|
|
|
2022-11-10 20:44:54 +00:00
|
|
|
rm -rf temp || :
|
2022-04-01 06:56:49 +00:00
|
|
|
fi
|
|
|
|
done
|
2022-04-01 06:34:12 +00:00
|
|
|
|
2022-04-01 10:12:48 +00:00
|
|
|
- name: Commit Website Changes
|
|
|
|
if: |
|
|
|
|
steps.collect-changes.outputs.changesDetected == 'true'
|
|
|
|
run: |
|
2022-07-12 20:38:48 +00:00
|
|
|
cd website
|
2022-04-01 10:12:48 +00:00
|
|
|
git config user.name "TrueCharts-Bot"
|
|
|
|
git config user.email "bot@truecharts.org"
|
|
|
|
git add --all
|
|
|
|
git commit -sm "Commit released docs for TrueCharts" || exit 0
|
2022-04-01 10:42:34 +00:00
|
|
|
git push
|
2022-04-01 10:12:48 +00:00
|
|
|
|
2022-11-10 19:39:03 +00:00
|
|
|
- name: Checkout Catalog
|
2022-12-13 15:30:19 +00:00
|
|
|
uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3
|
2022-04-03 15:15:08 +00:00
|
|
|
if: |
|
2022-04-07 13:25:14 +00:00
|
|
|
steps.collect-changes.outputs.changesDetectedAfterTag == 'true'
|
2022-04-01 09:03:57 +00:00
|
|
|
with:
|
|
|
|
fetch-depth: 1
|
|
|
|
repository: truecharts/catalog
|
|
|
|
token: ${{ secrets.BOT_TOKEN }}
|
2022-09-22 12:41:14 +00:00
|
|
|
ref: staging
|
2022-04-01 09:03:57 +00:00
|
|
|
path: catalog
|
|
|
|
|
2022-11-10 19:39:03 +00:00
|
|
|
- name: build catalog
|
2022-04-01 10:03:15 +00:00
|
|
|
shell: bash
|
2022-04-01 08:34:08 +00:00
|
|
|
if: |
|
2022-04-01 08:57:40 +00:00
|
|
|
steps.collect-changes.outputs.changesDetectedAfterTag == 'true'
|
2022-04-01 08:34:08 +00:00
|
|
|
run: |
|
2022-04-01 09:59:38 +00:00
|
|
|
CHARTS=(${{ steps.collect-changes.outputs.modifiedChartsAfterTag }})
|
2022-11-12 15:58:44 +00:00
|
|
|
charts_path="charts"
|
2022-11-12 15:17:43 +00:00
|
|
|
for changed in ${CHARTS[@]}; do
|
2022-11-12 15:04:04 +00:00
|
|
|
.github/scripts/fetch_helm_deps.sh "${changed}"
|
|
|
|
done
|
|
|
|
pip install yq
|
2022-04-03 08:55:01 +00:00
|
|
|
parthreads=$(($(nproc) * 2))
|
|
|
|
parallel -j ${parthreads} .github/scripts/build-catalog.sh '2>&1' ::: ${CHARTS[@]}
|
2022-12-01 11:56:51 +00:00
|
|
|
rm -rf website
|
2022-04-03 08:55:01 +00:00
|
|
|
|
2022-04-01 09:59:38 +00:00
|
|
|
- name: Commit Catalog
|
|
|
|
if: |
|
|
|
|
steps.collect-changes.outputs.changesDetected == 'true'
|
|
|
|
run: |
|
|
|
|
cd catalog
|
|
|
|
git config user.name "TrueCharts-Bot"
|
|
|
|
git config user.email "bot@truecharts.org"
|
|
|
|
git add --all
|
2022-07-12 20:38:48 +00:00
|
|
|
git commit -sm "Commit new Chart releases for TrueCharts" || exit 0
|
2022-04-02 08:19:14 +00:00
|
|
|
git push
|
2022-04-01 09:59:38 +00:00
|
|
|
cd -
|
|
|
|
rm -rf catalog
|
2022-11-12 15:58:44 +00:00
|
|
|
|
2022-11-11 19:01:23 +00:00
|
|
|
- name: set git author
|
|
|
|
if: |
|
|
|
|
steps.collect-changes.outputs.changesDetectedAfterTag == 'true'
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
git config user.name "TrueCharts-Bot"
|
|
|
|
git config user.email "bot@truecharts.org"
|
2022-11-12 15:58:44 +00:00
|
|
|
|
2022-11-11 18:30:43 +00:00
|
|
|
- name: Run chart-releaser for dependency apps
|
|
|
|
uses: helm/chart-releaser-action@98bccfd32b0f76149d188912ac8e45ddd3f8695f # tag=v1.4.1
|
|
|
|
if: |
|
|
|
|
steps.collect-changes.outputs.changesDetectedAfterTag == 'true'
|
|
|
|
with:
|
|
|
|
charts_dir: charts/dependency
|
|
|
|
charts_repo_url: https://charts.truecharts.org
|
|
|
|
env:
|
|
|
|
CR_TOKEN: "${{ secrets.BOT_TOKEN }}"
|
|
|
|
CR_SKIP_EXISTING: "true"
|
2022-11-12 15:58:44 +00:00
|
|
|
|
2022-11-11 18:51:04 +00:00
|
|
|
- name: Tag App Releases
|
|
|
|
if: |
|
|
|
|
steps.collect-changes.outputs.changesDetectedAfterTag == 'true'
|
2022-11-10 09:06:50 +00:00
|
|
|
shell: bash
|
|
|
|
run: |
|
2022-11-11 18:51:04 +00:00
|
|
|
#!/bin/bash
|
|
|
|
CHARTS=(${{ steps.collect-changes.outputs.modifiedChartsAfterTag }})
|
|
|
|
echo "Removing Chart Docs prior to regeneration..."
|
|
|
|
mkdir -p website/static/img/hotlink-ok/chart-icons || echo "chart-icons path already exists, continuing..."
|
|
|
|
for i in "${CHARTS[@]}"
|
|
|
|
do
|
|
|
|
IFS='/' read -r -a chart_parts <<< "$i"
|
|
|
|
if [ -f "charts/${chart_parts[0]}"/"${chart_parts[1]}/Chart.yaml" ]; then
|
|
|
|
train=${chart_parts[0]}
|
|
|
|
chart=${chart_parts[1]}
|
|
|
|
if [ "${train}" != "dependency" ]; then
|
|
|
|
echo "creating tag for ${chart}"
|
|
|
|
version=$(cat charts/${train}/${chart}/Chart.yaml | grep '^version: ' | awk -F" " '{ print $2 }' | head -1)
|
2022-11-20 19:45:32 +00:00
|
|
|
git tag ${chart}-${version} || echo "tag failed for ${chart}-${version}"
|
2022-11-11 18:51:04 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
git push --tags
|