2022-03-30 10:26:37 +00:00
|
|
|
name: "Charts: Release"
|
|
|
|
|
|
|
|
concurrency: helm-release
|
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
paths:
|
|
|
|
- "charts/**"
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
release:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
container:
|
2022-07-31 19:15:36 +00:00
|
|
|
image: ghcr.io/truecharts/devcontainer:v2.6.0@sha256:992e3c1df7245846a4d8f30fb0f21dc259d245ff41b3a1901284bdb26f4cb4cd
|
2022-03-30 10:26:37 +00:00
|
|
|
concurrency: gitpush
|
|
|
|
steps:
|
|
|
|
- name: Install Kubernetes tools
|
2022-06-29 10:18:35 +00:00
|
|
|
uses: yokawasa/action-setup-kube-tools@f7f73d7965074b0f5491b7210ff51e3254d42058 # tag=v0.8.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
|
|
|
|
|
|
|
- name: Install helm-docs
|
|
|
|
run: |
|
|
|
|
wget -O /tmp/helm-docs.deb https://github.com/k8s-at-home/helm-docs/releases/download/v0.1.1/helm-docs_0.1.1_Linux_x86_64.deb
|
|
|
|
sudo dpkg -i /tmp/helm-docs.deb
|
|
|
|
|
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
|
|
|
|
helm repo add metallb https://metallb.github.io/metallb
|
|
|
|
helm repo add grafana https://grafana.github.io/helm-charts
|
|
|
|
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-04-22 19:28:18 +00:00
|
|
|
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=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
|
|
|
|
|
|
|
- name: Collect changes
|
|
|
|
id: collect-changes
|
|
|
|
uses: ./.github/actions/collect-changes
|
|
|
|
|
2022-04-01 09:03:57 +00:00
|
|
|
- name: Generate README for changed charts
|
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-04-03 08:47:34 +00:00
|
|
|
parallel -j ${parthreads} .github/scripts/gen-docs.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-04-22 19:28:18 +00:00
|
|
|
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=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-07-12 22:21:41 +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}/README.md website/docs/charts/${train}/${chart}/index.md 2>/dev/null || :
|
|
|
|
yes | cp -rf charts/${train}/${chart}/CHANGELOG.md website/docs/charts/${train}/${chart}/CHANGELOG.md 2>/dev/null || :
|
|
|
|
yes | cp -rf charts/${train}/${chart}/docs/* website/docs/charts/${train}/${chart}/ 2>/dev/null || :
|
2022-08-01 20:54:37 +00:00
|
|
|
yes | cp -rf charts/${train}/${chart}/icon.png website/static/img/hotlink-ok/chart-icons/${chart}.png 2>/dev/null || :
|
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: Create commit
|
|
|
|
id: create-commit
|
2022-04-03 15:15:08 +00:00
|
|
|
if: |
|
|
|
|
steps.collect-changes.outputs.changesDetectedAfterTag == 'true'
|
2022-04-16 06:32:47 +00:00
|
|
|
uses: stefanzweifel/git-auto-commit-action@49620cd3ed21ee620a48530e81dba0d139c9cb80 # tag=v4
|
2022-04-01 10:12:48 +00:00
|
|
|
with:
|
|
|
|
file_pattern: charts/**/
|
|
|
|
commit_message: "chore: Auto-update chart README [skip ci]"
|
|
|
|
commit_user_name: truecharts-bot
|
|
|
|
commit_user_email: bot@truecharts.org
|
|
|
|
commit_author: truecharts-bot <bot@truecharts.org>
|
|
|
|
|
|
|
|
- name: Save commit hash
|
|
|
|
id: save-commit-hash
|
2022-04-03 15:15:08 +00:00
|
|
|
if: |
|
|
|
|
steps.collect-changes.outputs.changesDetectedAfterTag == 'true'
|
2022-04-01 10:12:48 +00:00
|
|
|
run: |
|
|
|
|
if [ "${{ steps.create-commit.outputs.changes_detected || 'unknown' }}" = "true" ]; then
|
|
|
|
echo '::set-output name=commit_hash::${{ steps.create-commit.outputs.commit_hash }}'
|
|
|
|
else
|
|
|
|
echo "::set-output name=commit_hash::${GITHUB_SHA}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
- 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
|
|
|
cd -
|
2022-07-12 20:38:48 +00:00
|
|
|
rm -rf website
|
2022-04-01 10:12:48 +00:00
|
|
|
|
2022-04-01 09:03:57 +00:00
|
|
|
- name: Checkout
|
2022-04-22 19:28:18 +00:00
|
|
|
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=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 }}
|
|
|
|
path: catalog
|
|
|
|
|
|
|
|
- name: Checkout
|
2022-04-22 19:28:18 +00:00
|
|
|
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3
|
2022-04-03 15:15:08 +00:00
|
|
|
if: |
|
|
|
|
steps.collect-changes.outputs.changesDetectedAfterTag == 'true'
|
2022-04-01 09:03:57 +00:00
|
|
|
with:
|
|
|
|
fetch-depth: 1
|
|
|
|
repository: truecharts/dh_catalog
|
|
|
|
token: ${{ secrets.BOT_TOKEN }}
|
|
|
|
path: dh_catalog
|
|
|
|
|
2022-04-01 08:34:08 +00:00
|
|
|
- name: build catalogs
|
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: |
|
|
|
|
pip install yq
|
2022-04-01 09:59:38 +00:00
|
|
|
CHARTS=(${{ steps.collect-changes.outputs.modifiedChartsAfterTag }})
|
2022-04-03 08:55:01 +00:00
|
|
|
parthreads=$(($(nproc) * 2))
|
|
|
|
parallel -j ${parthreads} .github/scripts/build-catalog.sh '2>&1' ::: ${CHARTS[@]}
|
|
|
|
|
|
|
|
- name: Generate docker-hub Catalog
|
|
|
|
shell: bash
|
|
|
|
if: |
|
|
|
|
steps.collect-changes.outputs.changesDetectedAfterTag == 'true'
|
|
|
|
run: |
|
|
|
|
rm -rf dh_catalog/*.*
|
|
|
|
rm -rf dh_catalog/*
|
|
|
|
cp -rf catalog/* dh_catalog
|
|
|
|
cd dh_catalog
|
|
|
|
find ./ -type f -name *.yaml -exec sed -i 's/tccr.io/dh.tccr.io/gI' {} \;
|
|
|
|
cd -
|
2022-04-01 09:59:38 +00:00
|
|
|
|
|
|
|
- name: Validate catalogs
|
|
|
|
if: |
|
|
|
|
steps.collect-changes.outputs.changesDetectedAfterTag == 'true'
|
|
|
|
run: |
|
|
|
|
echo "Starting Catalog Validation"
|
|
|
|
/usr/local/bin/catalog_validate validate --path "${PWD}/catalog"
|
|
|
|
|
|
|
|
- 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
|
|
|
|
|
|
|
|
- name: Commit DH Catalog
|
|
|
|
if: |
|
|
|
|
steps.collect-changes.outputs.changesDetected == 'true'
|
|
|
|
run: |
|
|
|
|
cd dh_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 dh_catalog
|
2022-04-01 08:34:08 +00:00
|
|
|
|
2022-03-30 10:26:37 +00:00
|
|
|
- name: Checkout
|
2022-04-22 19:28:18 +00:00
|
|
|
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3
|
2022-04-03 15:15:08 +00:00
|
|
|
if: |
|
|
|
|
steps.collect-changes.outputs.changesDetectedAfterTag == 'true'
|
2022-03-30 10:26:37 +00:00
|
|
|
with:
|
|
|
|
token: ${{ secrets.BOT_TOKEN }}
|
|
|
|
ref: ${{ steps.save-commit-hash.outputs.commit_hash }}
|
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
- name: Configure Git
|
2022-04-03 15:15:08 +00:00
|
|
|
if: |
|
|
|
|
steps.collect-changes.outputs.changesDetectedAfterTag == 'true'
|
2022-03-30 10:26:37 +00:00
|
|
|
run: |
|
|
|
|
git config user.name "truecharts-bot"
|
|
|
|
git config user.email "bot@truecharts.org"
|
|
|
|
|
|
|
|
- name: Run chart-releaser
|
2022-03-31 20:29:32 +00:00
|
|
|
uses: helm/chart-releaser-action@a3454e46a6f5ac4811069a381e646961dda2e1bf # tag=v1.4.0
|
2022-04-03 15:15:08 +00:00
|
|
|
if: |
|
|
|
|
steps.collect-changes.outputs.changesDetectedAfterTag == 'true'
|
2022-03-30 10:26:37 +00:00
|
|
|
with:
|
|
|
|
charts_dir: charts/*
|
|
|
|
charts_repo_url: https://charts.truecharts.org
|
|
|
|
env:
|
|
|
|
CR_TOKEN: "${{ secrets.BOT_TOKEN }}"
|
|
|
|
CR_SKIP_EXISTING: "true"
|