stages:
  - validate
  - build
  - deploy

image:
  name: ghcr.io/esphome/esphome:latest
  entrypoint: [""]

validate_configs:
  stage: validate
  script:
    - cat ${SECRETS_YAML} > packages/secrets.yaml
    - for yml in *.yaml; do esphome config ${yml} >/dev/null; done
  artifacts:
    expire_in: 1 hour
    paths:
      - packages/secrets.yaml
  tags:
    - kubernetes

deploy_configs:
  stage: deploy
  script:
    - cp -rv *.yaml packages /srv/esphome/growsmart/
  tags:
    - shell
