variables:
  GIT_SUBMODULE_STRATEGY: recursive

stages:
  - build
  - upload

build:
  image:
    name: alpine/helm
    entrypoint: ["/bin/sh", "-c"]
  stage: build
  script:
    - helm lint
    - helm package -d chart .
    - mv chart/glitchtip*.tgz chart/glitchtip.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/glitchtip.tgz" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/helm/api/stable/charts"'
  only:
    - tags