2022-03-30 06:26:37 -04:00
|
|
|
name: "Charts: Release"
|
|
|
|
|
|
|
|
concurrency: helm-release
|
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
paths:
|
|
|
|
- "charts/**"
|
|
|
|
|
|
|
|
jobs:
|
2022-09-22 08:54:25 -04:00
|
|
|
release-scale:
|
2022-03-30 06:26:37 -04:00
|
|
|
runs-on: ubuntu-latest
|
2022-11-10 04:06:50 -05:00
|
|
|
outputs:
|
|
|
|
ref: ${{ steps.save-commit-hash.outputs.commit_hash }}
|
2022-03-30 06:26:37 -04:00
|
|
|
container:
|
2022-11-06 14:21:06 -05:00
|
|
|
image: ghcr.io/truecharts/devcontainer:v2.6.0@sha256:5029ebed5c833646da3afb3a8512eba79f08cac8935a53fc1510854fec22341a
|
2022-03-30 06:26:37 -04:00
|
|
|
steps:
|
|
|
|
- name: Install Kubernetes tools
|
2022-11-03 04:43:41 -04:00
|
|
|
uses: yokawasa/action-setup-kube-tools@b91bb02bc122bd84ac7bbea5f25ed6b0f2ec6275 # tag=v0.9.2
|
2022-03-30 06:26:37 -04:00
|
|
|
with:
|
2022-03-30 08:59:33 -04:00
|
|
|
setup-tools: |
|
|
|
|
helmv3
|
|
|
|
helm: "3.8.0"
|
2022-03-30 06:26:37 -04:00
|
|
|
|
2022-04-01 05:45:11 -04: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 10:46:44 -05:00
|
|
|
|
2022-04-01 05:45:11 -04:00
|
|
|
helm repo add prometheus https://prometheus-community.github.io/helm-charts
|
|
|
|
helm repo update
|
|
|
|
|
2022-04-01 05:03:57 -04:00
|
|
|
- name: Checkout
|
2022-11-15 03:37:58 -05:00
|
|
|
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3
|
2022-04-01 05:03:57 -04:00
|
|
|
with:
|
|
|
|
token: ${{ secrets.BOT_TOKEN }}
|
2022-04-01 06:31:10 -04:00
|
|
|
fetch-depth: 0
|
2022-04-01 03:52:38 -04:00
|
|
|
|
|
|
|
- name: Collect changes
|
|
|
|
id: collect-changes
|
|
|
|
uses: ./.github/actions/collect-changes
|
|
|
|
|
2022-11-10 14:39:03 -05:00
|
|
|
- name: Generate Changelog
|
2022-04-01 05:34:46 -04:00
|
|
|
shell: bash
|
2022-04-01 05:32:27 -04:00
|
|
|
if: |
|
|
|
|
steps.collect-changes.outputs.changesDetectedAfterTag == 'true'
|
2022-04-01 05:03:57 -04:00
|
|
|
run: |
|
2022-04-01 05:32:27 -04:00
|
|
|
CHARTS=(${{ steps.collect-changes.outputs.modifiedChartsAfterTag }})
|
2022-04-03 04:43:00 -04:00
|
|
|
parthreads=$(($(nproc) * 2))
|
2022-11-10 14:39:03 -05:00
|
|
|
parallel -j ${parthreads} .github/scripts/changelog.sh '2>&1' ::: ${CHARTS[@]}
|
2022-04-03 04:43:00 -04:00
|
|
|
|
2022-04-01 05:45:11 -04: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 02:39:13 -04:00
|
|
|
- name: Checkout
|
2022-11-15 03:37:58 -05:00
|
|
|
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3
|
2022-04-03 11:15:08 -04:00
|
|
|
if: |
|
|
|
|
steps.collect-changes.outputs.changesDetectedAfterTag == 'true'
|
2022-04-01 02:39:13 -04:00
|
|
|
with:
|
|
|
|
fetch-depth: 1
|
2022-07-12 16:38:48 -04:00
|
|
|
repository: truecharts/website
|
2022-04-01 02:39:13 -04:00
|
|
|
token: ${{ secrets.BOT_TOKEN }}
|
2022-07-12 16:38:48 -04:00
|
|
|
path: website
|
2022-04-01 03:52:38 -04:00
|
|
|
|
2022-04-01 02:34:12 -04:00
|
|
|
- name: Copy docs to website
|
|
|
|
if: |
|
2022-04-01 04:57:40 -04:00
|
|
|
steps.collect-changes.outputs.changesDetectedAfterTag == 'true'
|
2022-04-01 03:27:52 -04:00
|
|
|
shell: bash
|
2022-04-01 02:34:12 -04:00
|
|
|
run: |
|
2022-04-01 03:17:25 -04:00
|
|
|
#!/bin/bash
|
2022-04-01 04:57:40 -04:00
|
|
|
CHARTS=(${{ steps.collect-changes.outputs.modifiedChartsAfterTag }})
|
2022-07-12 18:05:07 -04:00
|
|
|
echo "Removing Chart Docs prior to regeneration..."
|
2022-08-01 16:54:37 -04:00
|
|
|
mkdir -p website/static/img/hotlink-ok/chart-icons || echo "chart-icons path already exists, continuing..."
|
2022-04-01 02:56:49 -04: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-11-10 15:44:54 -05:00
|
|
|
mkdir -p tmp/website/docs/charts/${train}/${chart}/ || echo "chart path already exists, continuing..."
|
2022-11-10 16:44:16 -05:00
|
|
|
mv -f website/docs/charts/${train}/${chart}/CHANGELOG.md tmp/website/docs/charts/${train}/${chart}/CHANGELOG.md || :
|
2022-11-10 15:44:54 -05:00
|
|
|
rm -rf website/docs/charts/*/${chart} || :
|
2022-07-12 16:38:48 -04: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-11-10 16:44:16 -05:00
|
|
|
mv -f tmp/website/docs/charts/${train}/${chart}/CHANGELOG.md website/docs/charts/${train}/${chart}/CHANGELOG.md 2>/dev/null || :
|
2022-08-01 16:54:37 -04:00
|
|
|
yes | cp -rf charts/${train}/${chart}/icon.png website/static/img/hotlink-ok/chart-icons/${chart}.png 2>/dev/null || :
|
2022-11-10 14:39:03 -05:00
|
|
|
# Append SCALE changelog to actual changelog
|
|
|
|
if [[ -f "website/docs/charts/${train}/${chart}/CHANGELOG.md" ]]; then
|
2022-11-10 15:44:54 -05:00
|
|
|
echo "changelog found..."
|
2022-11-10 14:39:03 -05:00
|
|
|
true
|
|
|
|
else
|
2022-11-10 15:44:54 -05:00
|
|
|
echo "changelog not found, starting with empty changelog..."
|
2022-11-10 14:39:03 -05:00
|
|
|
touch "website/docs/charts/${train}/${chart}/CHANGELOG.md"
|
|
|
|
fi
|
2022-11-10 15:44:54 -05:00
|
|
|
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..."
|
|
|
|
rm -rf temp || :
|
2022-04-01 02:56:49 -04:00
|
|
|
fi
|
|
|
|
done
|
2022-04-01 02:34:12 -04:00
|
|
|
|
2022-04-01 06:12:48 -04:00
|
|
|
- name: Commit Website Changes
|
|
|
|
if: |
|
|
|
|
steps.collect-changes.outputs.changesDetected == 'true'
|
|
|
|
run: |
|
2022-07-12 16:38:48 -04:00
|
|
|
cd website
|
2022-04-01 06:12:48 -04: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 06:42:34 -04:00
|
|
|
git push
|
2022-04-01 06:12:48 -04:00
|
|
|
cd -
|
2022-07-12 16:38:48 -04:00
|
|
|
rm -rf website
|
2022-04-01 06:12:48 -04:00
|
|
|
|
2022-11-10 14:39:03 -05:00
|
|
|
- name: Checkout Catalog
|
2022-11-15 03:37:58 -05:00
|
|
|
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3
|
2022-04-03 11:15:08 -04:00
|
|
|
if: |
|
2022-04-07 09:25:14 -04:00
|
|
|
steps.collect-changes.outputs.changesDetectedAfterTag == 'true'
|
2022-04-01 05:03:57 -04:00
|
|
|
with:
|
|
|
|
fetch-depth: 1
|
|
|
|
repository: truecharts/catalog
|
|
|
|
token: ${{ secrets.BOT_TOKEN }}
|
2022-09-22 08:41:14 -04:00
|
|
|
ref: staging
|
2022-04-01 05:03:57 -04:00
|
|
|
path: catalog
|
|
|
|
|
2022-11-10 14:39:03 -05:00
|
|
|
- name: build catalog
|
2022-04-01 06:03:15 -04:00
|
|
|
shell: bash
|
2022-04-01 04:34:08 -04:00
|
|
|
if: |
|
2022-04-01 04:57:40 -04:00
|
|
|
steps.collect-changes.outputs.changesDetectedAfterTag == 'true'
|
2022-04-01 04:34:08 -04:00
|
|
|
run: |
|
2022-04-01 05:59:38 -04:00
|
|
|
CHARTS=(${{ steps.collect-changes.outputs.modifiedChartsAfterTag }})
|
2022-11-12 10:58:44 -05:00
|
|
|
charts_path="charts"
|
2022-11-12 10:17:43 -05:00
|
|
|
for changed in ${CHARTS[@]}; do
|
2022-11-12 10:04:04 -05:00
|
|
|
.github/scripts/fetch_helm_deps.sh "${changed}"
|
|
|
|
done
|
|
|
|
pip install yq
|
2022-04-03 04:55:01 -04:00
|
|
|
parthreads=$(($(nproc) * 2))
|
|
|
|
parallel -j ${parthreads} .github/scripts/build-catalog.sh '2>&1' ::: ${CHARTS[@]}
|
|
|
|
|
2022-04-01 05:59:38 -04: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 16:38:48 -04:00
|
|
|
git commit -sm "Commit new Chart releases for TrueCharts" || exit 0
|
2022-04-02 04:19:14 -04:00
|
|
|
git push
|
2022-04-01 05:59:38 -04:00
|
|
|
cd -
|
|
|
|
rm -rf catalog
|
2022-11-12 10:58:44 -05:00
|
|
|
|
2022-11-11 14:01:23 -05: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 10:58:44 -05:00
|
|
|
|
2022-11-11 13:30:43 -05: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 10:58:44 -05:00
|
|
|
|
2022-11-11 13:51:04 -05:00
|
|
|
- name: Tag App Releases
|
|
|
|
if: |
|
|
|
|
steps.collect-changes.outputs.changesDetectedAfterTag == 'true'
|
2022-11-10 04:06:50 -05:00
|
|
|
shell: bash
|
|
|
|
run: |
|
2022-11-11 13:51:04 -05: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)
|
|
|
|
git tag ${chart}-${version}
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
git push --tags
|