--- 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