garden-esphome/.drone.yml
Ryan Voots bd144e9089
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
ready to deploy!
2022-05-30 14:59:27 -04:00

125 lines
2.8 KiB
YAML

kind: pipeline
type: docker
name: build
trigger:
event:
include:
- tag
- push
platform:
os: linux
arch: amd64
node:
vlan: priviliged
steps:
- name: build_docker_perl
image: docker
volumes:
- name: dockersock
path: /var/run/docker.sock
commands:
- docker build -t garden-perl:latest -f ./Dockerfile.perl .
- name: build_code
image: garden-perl:latest
pull: if-not-exists
commands:
- perl build_config.pl
- tar -cvzf garden-watering.tar.gz dist/*
- name: gitea_release
image: plugins/gitea-release
settings:
files: garden-watering.tar.gz
api_key:
from_secret: gitea_api_key
base_url: https://gitea.simcop2387.info/
when:
event: tag
# - name: publish
# image: plugins/github-release
# settings:
# file_exists: skip
# api_key:
# from_secret: github_api_key
# files: garden-watering.tar.gz
# when:
# event: tag
- name: build_docker
image: docker
volumes:
- name: dockersock
path: /var/run/docker.sock
commands:
- docker build -t ssh-runner:latest .
- name: upload tarball
image: plugins/s3
settings:
bucket: drone
access_key:
from_secret: drone_minio_user
secret_key:
from_secret: drone_minio_pass
source: garden-watering.tar.gz
target: /garden-water/
path_style: true
endpoint: http://192.168.1.229:9000
- name: homeass_validate
image: registry.docker.home.simcop2387.info:443/simcop2387/esphome-local:latest
pull: if-not-exists
commands:
- curl http://192.168.1.229:9000/drone/garden-water/garden-watering.tar.gz -o garden-watering.tar.gz
- tar --strip-components=1 -xvf garden-watering.tar.gz
- ls -lah
- >-
sh -c 'echo wifi_ssid: "FakeWifi" >> secrets.yaml'
- >-
sh -c 'echo wifi_password: "foobarbazquux" >> secrets.yaml'
- esphome compile garden-watering.yaml
- name: deploy_to_esp
image: ssh-runner:latest
when:
event: tag
pull: if-not-exists
secrets: [ha_ssh_key]
environment:
SSH_KEY:
from_secret: ha_ssh_key
commands:
- mkdir /root/.ssh && echo "$${SSH_KEY}" > /root/.ssh/id_ed25519 && chmod 0600 /root/.ssh/id_ed25519
- ssh -oStrictHostKeyChecking=no esphome@esphome-x86.home.simcop2387.info 'cd esphome/config; curl http://192.168.1.229:9000/drone/garden-water/garden-watering.tar.gz -o /tmp/garden-watering.tar.gz; tar -xvf /tmp/garden-watering.tar.gz --strip-components=1; esphome upload --device garden-watering.local garden-watering.yaml;'
volumes:
- name: dockersock
host:
path: /var/run/docker.sock
#---
#kind: pipeline
#type: ssh
#name: deploy
#
#depends_on:
# - build
#
#server:
# host: homeassistant.private.simcop2387.info
# user: esphome_remote
# password:
# from_secret: esphome_remote_pass
#
#steps:
#- name: greeting
# commands:
# - echo hello world