stages:
  - validate
  - build
  - deploy

image:
  name: esphome/esphome:2023.9.3
  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:
    - docker

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