ci: Update chart release flow

Signed-off-by: Bᴇʀɴᴅ Sᴄʜᴏʀɢᴇʀs <me@bjw-s.dev>
This commit is contained in:
Bᴇʀɴᴅ Sᴄʜᴏʀɢᴇʀs 2022-02-04 14:31:20 +01:00
parent f74e6ebe07
commit bbb81ffb9e
No known key found for this signature in database
GPG Key ID: BC5E2BD907F9A8EC

View File

@ -26,6 +26,86 @@ jobs:
with: with:
token: ${{ steps.generate-token.outputs.token }} token: ${{ steps.generate-token.outputs.token }}
ref: master ref: master
- name: Install Kubernetes tools
uses: yokawasa/action-setup-kube-tools@v0.8.0
with:
setup-tools: |
helmv3
yq
helm: 3.6.3
yq: "4.16.2"
- 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
- name: Collect changed files
uses: dorny/paths-filter@v2
id: filter
with:
list-files: shell
filters: |
addedOrModified:
- added|modified: 'charts/**'
- name: Collect changed charts
if: |
steps.filter.outputs.addedOrModified == 'true'
id: filter-charts
run: |
CHARTS=()
PATHS=(${{ steps.filter.outputs.addedOrModified_files }})
# Get only the chart paths
for CHARTPATH in "${PATHS[@]}"
do
IFS='/' read -r -a path_parts <<< "${CHARTPATH}"
CHARTS+=("${path_parts[1]}/${path_parts[2]}")
done
# Remove duplicates
CHARTS=( `printf "%s\n" "${CHARTS[@]}" | sort -u` )
# Set output to changed charts
printf "::set-output name=addedOrModified::%s\n" "${CHARTS[*]}"
- name: Generate README for changed charts in Renovate PR's
if: |
steps.filter.outputs.addedOrModified == 'true'
run: |
CHARTS=(${{ steps.filter-charts.outputs.addedOrModified }})
for i in "${CHARTS[@]}"
do
IFS='/' read -r -a chart_parts <<< "$i"
if [ -f "charts/${chart_parts[0]}"/"${chart_parts[1]}/Chart.yaml" ]; then
./.github/scripts/gen-helm-docs.sh "${chart_parts[0]}" "${chart_parts[1]}"
fi
done
- name: Create commit
id: create-commit
uses: stefanzweifel/git-auto-commit-action@v4
with:
file_pattern: charts/**/
commit_message: Auto-update chart README [ci-skip]
commit_user_name: k8s-at-home[bot]
commit_user_email: k8s-at-home[bot]@users.noreply.github.com
commit_author: k8s-at-home[bot] <k8s-at-home[bot]@users.noreply.github.com>
- name: Store commit hash
id: store-commit-hash
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: Checkout
uses: actions/checkout@v2
with:
token: ${{ steps.generate-token.outputs.token }}
ref: ${{ steps.store-commit-hash.outputs.commit_hash }}
fetch-depth: 0 fetch-depth: 0
- name: Configure Git - name: Configure Git
@ -33,11 +113,6 @@ jobs:
git config user.name "k8s-at-home[bot]" git config user.name "k8s-at-home[bot]"
git config user.email "k8s-at-home[bot]@users.noreply.github.com" git config user.email "k8s-at-home[bot]@users.noreply.github.com"
- name: Install Helm
uses: azure/setup-helm@v1
with:
version: v3.6.3
- name: Run chart-releaser - name: Run chart-releaser
uses: helm/chart-releaser-action@v1.2.1 uses: helm/chart-releaser-action@v1.2.1
with: with: