helm: push chart to github container registry with

supports OCI specification

Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: I5bc031552fe2eb6940f068dcef82fe71f640585c
pull/7869/head
Rash419 2023-12-20 13:51:22 +05:30 committed by Rashesh Padia
parent 5403d885a3
commit 1c3fc8dadf
1 changed files with 25 additions and 1 deletions

View File

@ -13,6 +13,7 @@ jobs:
# see: https://docs.github.com/en/actions/security-guides/automatic-token-authentication#modifying-the-permissions-for-the-github_token
permissions:
contents: write
packages: write
runs-on: ubuntu-latest
steps:
- name: Checkout
@ -32,10 +33,33 @@ jobs:
- name: Run chart-releaser
# for use with make-release-latest
uses: helm/chart-releaser-action@v1
uses: helm/chart-releaser-action@v1.6.0
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
CR_SKIP_EXISTING: true
with:
charts_dir: "kubernetes/helm"
config: kubernetes/helm/cr.yaml
# see https://github.com/helm/chart-releaser/issues/183
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push charts to GHCR
run: |
shopt -s nullglob
for pkg in .cr-release-packages/*; do
if [ -z "${pkg:-}" ]; then
break
fi
# convert uppercase->lowercase to make sure it follows oci rules
lowercase=$(echo "${GITHUB_REPOSITORY_OWNER}" | tr '[:upper:]' '[:lower:]')
echo "Pushing package - ${pkg} to repository - ${lowercase}"
helm push "${pkg}" "oci://ghcr.io/${lowercase}/charts"
done