diff --git a/.github/workflows/release-unified.yaml b/.github/workflows/release-unified.yaml index 0e4dae9..750135e 100644 --- a/.github/workflows/release-unified.yaml +++ b/.github/workflows/release-unified.yaml @@ -107,13 +107,55 @@ jobs: cache-to: type=gha,mode=max platforms: linux/amd64 - - name: Package Helm Chart + - name: Package and Publish Helm Chart to GitHub Pages run: | - helm registry login ghcr.io \ - --username ${{ github.actor }} \ - --password ${{ secrets.GITHUB_TOKEN }} + # Package the chart helm package chart/ - helm push devcontainer-${{ steps.version.outputs.version }}.tgz oci://ghcr.io/cpfarhood/charts + + # Checkout or create gh-pages branch in a temporary directory + git worktree add /tmp/gh-pages gh-pages 2>/dev/null || { + git worktree add --detach /tmp/gh-pages + cd /tmp/gh-pages + git checkout --orphan gh-pages + git rm -rf . 2>/dev/null || true + cat > index.html <<'HTMLEOF' + + + Dev Container Helm Chart Repository + +

Dev Container Helm Chart Repository

+

Add this repository to Helm:

+
helm repo add devcontainer https://cpfarhood.github.io/devcontainer
+

Install the chart:

+
helm install mydev devcontainer/devcontainer --set name=mydev
+ + + HTMLEOF + git add index.html + git commit -m "Initialize gh-pages branch" + git push origin gh-pages + cd - + } + + # Copy packaged chart to gh-pages worktree + cp devcontainer-${{ steps.version.outputs.version }}.tgz /tmp/gh-pages/ + + # Update Helm repo index + cd /tmp/gh-pages + if [ -f index.yaml ]; then + helm repo index . --url https://cpfarhood.github.io/devcontainer --merge index.yaml + else + helm repo index . --url https://cpfarhood.github.io/devcontainer + fi + + # Commit and push + git add index.yaml *.tgz index.html 2>/dev/null || true + git commit -m "Publish chart ${{ steps.version.outputs.version }}" + git push origin gh-pages + cd - + + # Clean up worktree + git worktree remove /tmp/gh-pages - name: Generate Release Notes id: notes @@ -139,7 +181,9 @@ jobs: ### Helm Chart \`\`\`bash - helm install devcontainer oci://ghcr.io/cpfarhood/charts/devcontainer --version ${{ steps.version.outputs.version }} + helm repo add devcontainer https://cpfarhood.github.io/devcontainer + helm repo update + helm install mydev devcontainer/devcontainer --version ${{ steps.version.outputs.version }} --set name=mydev \`\`\` EOF