platform: linux/amd64

labels:
  type: exec

pipeline:
- name: publish-charts
  image: bash
  commands:
  - pip install -r requirements.txt
  - python3 _scripts/dependency_update.py "oci://$DRYCC_REGISTRY/$([ -z $DRONE_TAG ] && echo charts-testing || echo charts)" "charts/workflow/Chart.yaml" 
  - helm dependency update charts/workflow
  - helm package charts/workflow -u --version $([ -z $DRONE_TAG ] && echo 1.0.0 || echo ${DRONE_TAG##v})
  - echo $CONTAINER_PASSWORD | helm registry login $DRYCC_REGISTRY -u $CONTAINER_USERNAME --password-stdin
  - helm push workflow-$([ -z $DRONE_TAG ] && echo 1.0.0 || echo ${DRONE_TAG##v}).tgz oci://$DRYCC_REGISTRY/$([ -z $DRONE_TAG ] && echo charts-testing || echo charts)
  - bash _scripts/generate_cache.sh 
  secrets:
  - drycc_registry
  - container_username
  - container_password
  when:
    event:
    - tag
    - push
