---
helm:release:
  image: alpine/k8s:1.21.5
  stage: build
  variables:
    HELM_RELEASE_CHANNEL: stable
  script:
    - helm package ./
    - helm repo index ./ --url ${CI_PROJECT_PATH}
    - helm repo add --username gitlab-ci-token --password ${CI_JOB_TOKEN} ${CI_PROJECT_NAME} "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/helm/${HELM_RELEASE_CHANNEL}"
    - helm cm-push *-${CI_COMMIT_TAG}.tgz ${CI_PROJECT_NAME}
  rules:
    - if: $CI_COMMIT_TAG
  artifacts:
    paths:
      - index.yaml