-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
67 lines (61 loc) · 1.33 KB
/
.gitlab-ci.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
---
stages:
- setup
- test
- deploy
- restart
setup:
# necessary in order to use variable for image in test stage
stage: setup
script:
- echo -n "HA_VERSION=" | cat - .HA_VERSION >> build.env
artifacts:
reports:
dotenv: build.env
lint yaml:
stage: test
image: sdesbure/yamllint
before_script:
- yamllint --version
script:
- yamllint .
test config:
stage: test
dependencies:
- setup
image:
name: homeassistant/home-assistant:$HA_VERSION
entrypoint: [""]
script:
- sh ./build/test.sh
deploy:
stage: deploy
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
image: alpine:latest
before_script:
- apk update && apk add openssh-client rsync
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
- mkdir -p ~/.ssh && chmod 700 ~/.ssh
- echo "$SSH_HOST_KEY" > ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
script:
- sh ./build/deploy.sh
restart homeassistant:
stage: restart
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
changes:
- custom_components/**/*
- "**/*.yaml"
script:
- apk update && apk add curl
- sh ./build/restart.sh
redeploy docker:
stage: restart
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
changes:
- .HA_VERSION
trigger: koen/docker