--- 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 uses: actions/github-script@v7 with: script: | const dstFolder = "${{ inputs.targetFolder }}"; const artifactPrefix = "${{ inputs.artifactPrefix }}"; baseDir = process.cwd(); artifactsDir = `${baseDir}/artifacts`; const globber = await glob.create(`${artifactsDir}/${artifactPrefix}*/*.tgz`); for await (const file of globber.globGenerator()) { relativePath = file.startsWith(artifactsDir) ? file.slice(artifactsDir.length) : file; artifactFolder = relativePath.split('/')[1]; artifactFolderStrippedPrefix = artifactFolder.startsWith(artifactPrefix) ? artifactFolder.slice(artifactPrefix.length) : artifactFolder; chartType = artifactFolderStrippedPrefix.split('__')[0]; targetFolder = `${baseDir}/${dstFolder}/${chartType}`; console.log(`Copying ${file} to ${targetFolder}/`); await io.mkdirP(targetFolder); await io.cp(file, `${targetFolder}/`); } - 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"