ci: Rework publishing CI (#381)

This commit is contained in:
Bernd Schorgers 2025-02-10 13:05:48 +01:00
parent b8c2eca310
commit c94a28baa3
No known key found for this signature in database
GPG key ID: BC5E2BD907F9A8EC
10 changed files with 512 additions and 274 deletions

View file

@ -0,0 +1,70 @@
---
name: "Prepare chart artifacts for release"
description: "Prepare chart artifacts for release to GitHub Pages"
inputs:
artifactPattern:
description: "Pattern to match artifacts to release"
required: true
artifactPrefix:
description: "Prefix to strip from the artifact names"
required: false
default: ""
targetFolder:
description: "Folder where to move the chart artifacts"
required: true
default: gh-pages
targetBranch:
description: "Branch to push the chart artifacts"
required: true
default: gh-pages
runs:
using: "composite"
steps:
- name: Prepare artifacts folder
shell: bash
run: |
mkdir -p artifacts
- name: Download chart artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
pattern: ${{ inputs.artifactPrefix }}${{ inputs.artifactPattern }}
- name: Copy artifacts to gh-pages structure
shell: bash
working-directory: artifacts
env:
ARTIFACT_PREFIX: ${{ inputs.artifactPrefix }}
TARGET_FOLDER: ${{ inputs.targetFolder }}
run: |
while IFS= read -d $'\0' -r ARTIFACT ; do
echo ${ARTIFACT}
prefix_removed_chart=${ARTIFACT/#$ARTIFACT_PREFIX}
DELIMITER='__'
s=${prefix_removed_chart}${DELIMITER}
ARTIFACT_PATH_PARTS=();
while [[ $s ]]; do
ARTIFACT_PATH_PARTS+=( "${s%%"${DELIMITER}"*}" );
s=${s#*"${DELIMITER}"};
done;
CHART_FOLDER=${ARTIFACT_PATH_PARTS[0]}
mkdir -p "${TARGET_FOLDER}/${CHART_FOLDER}"
cp ${ARTIFACT}/* ${TARGET_FOLDER}/${CHART_FOLDER}/
done < <(find . -mindepth 1 -maxdepth 1 -type d -print0)
- name: Update chart index
shell: bash
working-directory: ${{ inputs.targetFolder }}
run: |
helm repo index . --url https://bjw-s.github.io/helm-charts/
- name: Commit Changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
repository: ${{ inputs.targetFolder }}
branch: ${{ inputs.targetBranch }}
file_pattern: "index.yaml **/*.tgz"
disable_globbing: true