|
| 1 | +name: Helm OCI Chart Releaser |
| 2 | +description: Push Helm charts to OCI-based (Docker) registries |
| 3 | +inputs: |
| 4 | + name: |
| 5 | + required: true |
| 6 | + description: Chart name |
| 7 | + repository: |
| 8 | + required: true |
| 9 | + description: Chart repository name |
| 10 | + app-version: |
| 11 | + description: "Chart Application Version" |
| 12 | + required: false |
| 13 | + version: |
| 14 | + required: false |
| 15 | + description: Chart version |
| 16 | + path: |
| 17 | + required: false |
| 18 | + description: Chart path (Default 'charts/{name}') |
| 19 | + registry: |
| 20 | + required: true |
| 21 | + description: OCI registry |
| 22 | + registry-username: |
| 23 | + required: true |
| 24 | + description: OCI registry username |
| 25 | + registry-password: |
| 26 | + required: true |
| 27 | + description: OCI registry password |
| 28 | + update-dependencies: |
| 29 | + required: false |
| 30 | + default: 'false' |
| 31 | + description: Update chart dependencies before packaging (Default 'false') |
| 32 | + sign-image: |
| 33 | + required: false |
| 34 | + default: 'false' |
| 35 | + description: Sign chart package with Cosign |
| 36 | + signature-repository: |
| 37 | + required: true |
| 38 | + description: signature repository |
| 39 | + |
| 40 | +outputs: |
| 41 | + digest: |
| 42 | + value: ${{ steps.helm-push.outputs.digest }} |
| 43 | + description: "Chart digest" |
| 44 | + image: |
| 45 | + value: ${{ steps.helm-push.outputs.image }} |
| 46 | + description: Chart image (Default '{registry}/{repository}/{image}:{version}') |
| 47 | +runs: |
| 48 | + using: composite |
| 49 | + steps: |
| 50 | + |
| 51 | + - name: Helm | Login |
| 52 | + shell: bash |
| 53 | + run: echo ${{ inputs.registry-password }} | helm registry login -u ${{ inputs.registry-username }} --password-stdin ${{ inputs.registry }} |
| 54 | + env: |
| 55 | + HELM_EXPERIMENTAL_OCI: '1' |
| 56 | + |
| 57 | + - name: Cosign | Login |
| 58 | + if: inputs.sign-image == 'true' |
| 59 | + shell: bash |
| 60 | + run: cosign login --username ${{ inputs.registry-username }} --password ${{ inputs.registry-password }} ${{ inputs.registry }} |
| 61 | + |
| 62 | + - name: Helm | Dependency |
| 63 | + if: inputs.update-dependencies == 'true' |
| 64 | + shell: bash |
| 65 | + run: helm dependency update ${{ inputs.path == null && format('{0}/{1}', 'charts', inputs.name) || inputs.path }} |
| 66 | + env: |
| 67 | + HELM_EXPERIMENTAL_OCI: '1' |
| 68 | + |
| 69 | + - name: Helm | Package |
| 70 | + shell: bash |
| 71 | + run: helm package --destination ./chart-build/ ${{ inputs.path == null && format('{0}/{1}', 'charts', inputs.name) || inputs.path }} ${{ inputs.version != '' && format('--version={0}', inputs.version) || '' }} ${{ inputs.app-version != '' && format('--app-version={0}', inputs.app-version) || '' }} |
| 72 | + env: |
| 73 | + HELM_EXPERIMENTAL_OCI: '1' |
| 74 | + |
| 75 | + - name: Helm | Push |
| 76 | + shell: bash |
| 77 | + id: helm-push |
| 78 | + run: | |
| 79 | + CHART_FILE=$(find ./chart-build -name "*.tgz" -print -quit) |
| 80 | + helm push $CHART_FILE oci://${{ inputs.registry }}/${{ inputs.repository }} |& tee digest |
| 81 | + DIGEST=$(sed -n '/Digest:/s/Digest: //p' digest) |
| 82 | + echo "image=${{ inputs.registry }}/${{ inputs.repository }}/${{ inputs.name }}:${{ inputs.version }}" >> $GITHUB_OUTPUT |
| 83 | + echo "digest=$DIGEST" >> $GITHUB_OUTPUT |
| 84 | + env: |
| 85 | + HELM_EXPERIMENTAL_OCI: '1' |
| 86 | + |
| 87 | + - name: Cosign | Sign |
| 88 | + shell: bash |
| 89 | + if: inputs.sign-image == 'true' |
| 90 | + env: |
| 91 | + COSIGN_REPOSITORY: ${{ inputs.signature-repository }} |
| 92 | + run: | |
| 93 | + set -e |
| 94 | + cosign sign --yes \ |
| 95 | + -a "repo=${{ github.repository }}" \ |
| 96 | + -a "workflow=${{ github.workflow }}" \ |
| 97 | + -a "ref=${{ github.sha }}" \ |
| 98 | + ${{ steps.helm-push.outputs.image }}@${{ steps.helm-push.outputs.digest }} |
| 99 | +
|
| 100 | + - name: Helm | Logout |
| 101 | + shell: bash |
| 102 | + run: helm registry logout ${{ inputs.registry }} |
| 103 | + env: |
| 104 | + HELM_EXPERIMENTAL_OCI: '1' |
0 commit comments