|
| 1 | +name: 'Helm Chart Repo (ghcr.io)' |
| 2 | +description: 'Turn your repo with charts into a Helm charts repo on GitHub Container Registry, ghcr.io (OCI-based). Works on private repos.' |
| 3 | +branding: |
| 4 | + icon: 'anchor' |
| 5 | + color: 'blue' |
| 6 | +inputs: |
| 7 | + chartsPath: |
| 8 | + description: 'The path where to find the charts. Usually either "charts/" or "./". Must end with a slash.' |
| 9 | + required: false |
| 10 | + default: './' |
| 11 | + token: |
| 12 | + description: 'GitHub Token {{ secrets.GITHUB_TOKEN }} with the privilege set to write packages.' |
| 13 | + required: true |
| 14 | +runs: |
| 15 | + using: "composite" |
| 16 | + steps: |
| 17 | + |
| 18 | + - name: Package Helm Charts |
| 19 | + shell: bash |
| 20 | + run: | |
| 21 | + find ${CHARTS_PATH} -type f -name 'Chart.yaml' | sed -r 's|/[^/]+$||' | sort | uniq | xargs --verbose -L 1 helm dep up |
| 22 | + for d in ${CHARTS_PATH}*/ ; do |
| 23 | + if [[ ! -f "${d}Chart.yaml" ]]; then |
| 24 | + echo "${d}Chart.yaml not found. Skipping." |
| 25 | + continue |
| 26 | + fi |
| 27 | + echo "$d" |
| 28 | + helm package "$d" -u -d dist |
| 29 | + done |
| 30 | + env: |
| 31 | + CHARTS_PATH: ${{ inputs.chartsPath }} |
| 32 | + |
| 33 | + - name: Login to GitHub Container Registry (helm) |
| 34 | + shell: bash |
| 35 | + run: echo "${GITHUB_TOKEN}" | helm registry login ${REGISTRY} --username ${GITHUB_ACTOR} --password-stdin |
| 36 | + env: |
| 37 | + REGISTRY: "ghcr.io/${{ github.repository }}" |
| 38 | + GITHUB_TOKEN: ${{ inputs.token }} |
| 39 | + |
| 40 | + - name: Login to GitHub Container Registry (docker) |
| 41 | + shell: bash |
| 42 | + run: echo "${GITHUB_TOKEN}" | docker login ${REGISTRY} --username ${GITHUB_ACTOR} --password-stdin |
| 43 | + env: |
| 44 | + REGISTRY: "ghcr.io/${{ github.repository }}" |
| 45 | + GITHUB_TOKEN: ${{ inputs.token }} |
| 46 | + |
| 47 | + - name: Push Helm Charts to Github Container Registry (OCI) |
| 48 | + shell: bash |
| 49 | + working-directory: dist |
| 50 | + run: | |
| 51 | + for f in *.tgz ; do |
| 52 | + echo "helm push $f oci://${REGISTRY}" |
| 53 | + helm push $f oci://${REGISTRY} |
| 54 | + done |
| 55 | + env: |
| 56 | + REGISTRY: "ghcr.io/${{ github.repository }}" |
0 commit comments