TrueChartsClone/.github/workflows/charts-release.yaml

234 lines
9.1 KiB
YAML
Raw Normal View History

2022-03-30 06:26:37 -04:00
name: "Charts: Release"
concurrency: helm-release
on:
workflow_dispatch:
push:
branches:
- master
paths:
- "charts/**"
jobs:
release-scale:
2022-03-30 06:26:37 -04:00
runs-on: ubuntu-latest
outputs:
ref: ${{ steps.save-commit-hash.outputs.commit_hash }}
2022-03-30 06:26:37 -04:00
container:
image: ghcr.io/truecharts/devcontainer:v2.6.0@sha256:5029ebed5c833646da3afb3a8512eba79f08cac8935a53fc1510854fec22341a
2022-03-30 06:26:37 -04:00
steps:
- name: Install Kubernetes tools
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
- 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 prometheus https://prometheus-community.github.io/helm-charts
helm repo update
- name: Checkout
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3
with:
token: ${{ secrets.BOT_TOKEN }}
2022-04-01 06:31:10 -04:00
fetch-depth: 0
- name: Collect changes
id: collect-changes
uses: ./.github/actions/collect-changes
- name: Generate Changelog
2022-04-01 05:34:46 -04:00
shell: bash
if: |
steps.collect-changes.outputs.changesDetectedAfterTag == 'true'
run: |
CHARTS=(${{ steps.collect-changes.outputs.modifiedChartsAfterTag }})
2022-04-03 04:43:00 -04:00
parthreads=$(($(nproc) * 2))
parallel -j ${parthreads} .github/scripts/changelog.sh '2>&1' ::: ${CHARTS[@]}
2022-04-03 04:43:00 -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
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=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
repository: truecharts/website
2022-04-01 02:39:13 -04:00
token: ${{ secrets.BOT_TOKEN }}
path: website
2022-04-01 02:34:12 -04:00
- name: Copy docs to website
if: |
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
CHARTS=(${{ steps.collect-changes.outputs.modifiedChartsAfterTag }})
2022-07-12 18:05:07 -04:00
echo "Removing Chart Docs prior to regeneration..."
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} || :
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 || :
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
if [[ -f "website/docs/charts/${train}/${chart}/CHANGELOG.md" ]]; then
2022-11-10 15:44:54 -05:00
echo "changelog found..."
true
else
2022-11-10 15:44:54 -05:00
echo "changelog not found, starting with empty changelog..."
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
- name: Commit Website Changes
if: |
steps.collect-changes.outputs.changesDetected == 'true'
run: |
cd website
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
git push
cd -
rm -rf website
- name: Checkout Catalog
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3
2022-04-03 11:15:08 -04:00
if: |
steps.collect-changes.outputs.changesDetectedAfterTag == 'true'
with:
fetch-depth: 1
repository: truecharts/catalog
token: ${{ secrets.BOT_TOKEN }}
ref: staging
path: catalog
- name: build catalog
shell: bash
if: |
steps.collect-changes.outputs.changesDetectedAfterTag == 'true'
run: |
pip install yq
CHARTS=(${{ steps.collect-changes.outputs.modifiedChartsAfterTag }})
parthreads=$(($(nproc) * 2))
parallel -j ${parthreads} .github/scripts/build-catalog.sh '2>&1' ::: ${CHARTS[@]}
- 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
git commit -sm "Commit new Chart releases for TrueCharts" || exit 0
2022-04-02 04:19:14 -04:00
git push
cd -
rm -rf catalog
release-helm:
runs-on: ubuntu-latest
container:
image: ghcr.io/truecharts/devcontainer:v2.6.0@sha256:5029ebed5c833646da3afb3a8512eba79f08cac8935a53fc1510854fec22341a
needs: release-scale
steps:
- name: Install Kubernetes tools
uses: yokawasa/action-setup-kube-tools@b91bb02bc122bd84ac7bbea5f25ed6b0f2ec6275 # tag=v0.9.2
with:
setup-tools: |
helmv3
helm: "3.8.0"
- 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 prometheus https://prometheus-community.github.io/helm-charts
helm repo update
2022-03-30 06:26:37 -04:00
- name: Checkout
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3
2022-03-30 06:26:37 -04:00
with:
token: ${{ secrets.BOT_TOKEN }}
fetch-depth: 0
- name: Fix Pre-Commit issues
shell: bash
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
- name: Configure Git
run: |
git config user.name "truecharts-bot"
git config user.email "bot@truecharts.org"
- name: Run chart-releaser for dependency apps
uses: helm/chart-releaser-action@98bccfd32b0f76149d188912ac8e45ddd3f8695f # tag=v1.4.1
if: |
steps.collect-changes.outputs.changesDetectedAfterTag == 'true'
2022-03-30 06:26:37 -04:00
with:
charts_dir: charts/dependency
2022-03-30 06:26:37 -04:00
charts_repo_url: https://charts.truecharts.org
env:
CR_TOKEN: "${{ secrets.BOT_TOKEN }}"
CR_SKIP_EXISTING: "true"
- name: Run chart-releaser for enterprise apps
uses: helm/chart-releaser-action@98bccfd32b0f76149d188912ac8e45ddd3f8695f # tag=v1.4.1
with:
charts_dir: charts/enterprise
charts_repo_url: https://charts.truecharts.org
env:
CR_TOKEN: "${{ secrets.BOT_TOKEN }}"
CR_SKIP_EXISTING: "true"
- name: Run chart-releaser for stable
uses: helm/chart-releaser-action@98bccfd32b0f76149d188912ac8e45ddd3f8695f # tag=v1.4.1
with:
charts_dir: charts/stable
charts_repo_url: https://charts.truecharts.org
env:
CR_TOKEN: "${{ secrets.BOT_TOKEN }}"
CR_SKIP_EXISTING: "true"
- name: Run chart-releaser for stable
uses: helm/chart-releaser-action@98bccfd32b0f76149d188912ac8e45ddd3f8695f # tag=v1.4.1
with:
charts_dir: charts/incubator
charts_repo_url: https://charts.truecharts.org
env:
CR_TOKEN: "${{ secrets.BOT_TOKEN }}"
CR_SKIP_EXISTING: "true"