-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.drone.yml
161 lines (144 loc) · 3.46 KB
/
.drone.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
---
kind: pipeline
name: validate
trigger:
branch:
- master
- develop
event:
exclude:
- pull_request
steps:
- name: yamllint
image: cytopia/yamllint:latest
commands:
- yamllint .
- name: jsonlint
image: sahsu/docker-jsonlint
commands:
- jsonlint --version || true
- |
for file in $(find . -type f -name "*.json" -path "mysensors.json" -prune); do
if ! jsonlint -q $file; then
export FAILED=1
else
echo "$file OK"
fi
done
if [ "${FAILED}" = "1" ]; then
exit 1
fi
- name: pylint
image: cytopia/pylint:latest
commands:
- pylint ./python_scripts/*.py
---
kind: pipeline
name: test
trigger:
branch:
- master
- develop
event:
exclude:
- pull_request
steps:
- name: stage files
image: alpine:latest
commands:
- mv fake_secrets.yaml secrets.yaml
- name: hass-latest
image: homeassistant/home-assistant:latest
pull: if-not-exists
commands:
# - mv fake_secrets.yaml secrets.yaml
- python -m homeassistant --script check_config --info all --config .
- name: hass-rc
image: homeassistant/home-assistant:rc
pull: if-not-exists
commands:
# - mv fake_secrets.yaml secrets.yaml
- python -m homeassistant --script check_config --info all --config .
- name: hass-dev
image: homeassistant/home-assistant:dev
pull: if-not-exists
commands:
# - mv fake_secrets.yaml secrets.yaml
- python -m homeassistant --script check_config --info all --config .
---
kind: pipeline
name: upgrade
depends_on:
- validate
- test
trigger:
branch:
- master
event:
exclude:
- pull_request
steps:
- name: upgrade to hass-latest
image: appleboy/drone-ssh
settings:
host:
- '192.168.30.10'
username: root
key:
from_secret: ssh_key
port: 22
script:
- source '/etc/profile.d/homeassistant.sh' # <-- https://github.com/hassio-addons/addon-ssh/issues/115
- echo "Updating Home Assistant Core"
- echo "current core is $(ha core info | grep ^version:)"
- ha core update
- echo "updated core is $(ha core info | grep ^version:)"
- echo "Updating Home Assistant Supervisor"
- echo "current supervisor is $(ha supervisor info | grep ^version:)"
- ha supervisor update
- echo "updated supervisor is $(ha supervisor info | grep ^version:)"
---
kind: pipeline
name: deploy
depends_on:
- validate
- test
- upgrade
trigger:
branch:
- master
event:
exclude:
- pull_request
steps:
- name: git pull
image: appleboy/drone-ssh
settings:
host:
- '192.168.30.10'
username: root
key:
from_secret: ssh_key
port: 22
script:
- cd ~/config
- git fetch
- git reset --hard origin/master
- name: restart
image: appleboy/drone-ssh
settings:
host:
- '192.168.30.10'
username: root
key:
from_secret: ssh_key
port: 22
script:
- source '/etc/profile.d/homeassistant.sh' # <-- https://github.com/hassio-addons/addon-ssh/issues/115
- echo "restarting home assistant"
- ha core restart
#! - re-generate signature if changed via `drone sign jinkang23/Home-AssistantConfig --save`
---
kind: signature
hmac: 973d0f692f757b605a744b20c68e7fb7c402cd7b480dca47db3f53d36d5692bf
...