stages:
  - build
  - upload

build:
  image:
    name: alpine/helm
    entrypoint: ["/bin/sh", "-c"]
  stage: build
  script:
    - helm lint
    - helm package -d chart .
    - mv chart/django*.tgz chart/django.tgz
  artifacts:
    paths:
      - chart

upload:
  image: curlimages/curl:latest
  stage: upload
  dependencies:
    - build
  script:
    - 'curl --request POST --user gitlab-ci-token:$CI_JOB_TOKEN --form "chart=@chart/django.tgz" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/helm/api/stable/charts"'
  only:
    - tags