-
Notifications
You must be signed in to change notification settings - Fork 12
/
.drone.yml
94 lines (87 loc) · 2.31 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
kind: pipeline
name: goAdmin-后端
type: docker
clone:
depth: 1
steps:
- name: submodules
image: alpine/git
environment:
SSH_PRIVATE_KEY:
from_secret: ssh_key
commands:
- sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories
- 'which ssh-agent || ( apk update && apk --no-cache add openssh-client)'
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" > deploy.key
- chmod 0600 deploy.key
- ssh-add deploy.key
- mkdir -p ~/.ssh
- echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
- git submodule update --init --recursive
- name: 构建服务端镜像
pull: if-not-exists
image: plugins/docker
settings:
storage_driver: vfs
tags:
- latest
- ${DRONE_BUILD_NUMBER}
insecure: true
use_cache: true
registry:
from_secret: harbor_address
repo:
from_secret: harbor_repo
username:
from_secret: harbor_user
password:
from_secret: harbor_pass
context: ./
dockerfile: ./Dockerfile
when:
status:
- success
- name: deploy
image: alpine
pull: if-not-exists
commands:
- sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories
- apk update
- apk --no-cache add curl
# portainer hook
# - curl -XPOST http://192.168.1.9:9000/api/stacks/webhooks/ea389514-d123-4ce2-88e1-7385029e8af0
- name: send telegram notification
image: appleboy/drone-telegram
pull: if-not-exists
when:
status:
- success
- failure
settings:
token:
from_secret: telegram_token
to:
from_secret: telegram_to
format: markdown
message: >
{{#success build.status}}
✅ Build #{{build.number}} of `{{repo.name}}` succeeded.
📝 Commit by {{commit.author}} on `{{commit.branch}}`:
```
{{commit.message}}
```
🌐 {{ build.link }}
{{else}}
❌ Build #{{build.number}} of `{{repo.name}}` failed.
📝 Commit by {{commit.author}} on `{{commit.branch}}`:
```
{{commit.message}}
```
🌐 {{ build.link }}
{{/success}}
trigger:
branch:
- master
event:
- push