-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.drone.yml
More file actions
137 lines (130 loc) · 3 KB
/
Copy path.drone.yml
File metadata and controls
137 lines (130 loc) · 3 KB
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
kind: pipeline
type: docker
name: blog_front #定义drone中的前端项目名称
steps: # 定义流水线执行步骤,这些步骤将顺序执行
- name: restore-cache
image: drillster/drone-volume-cache
volumes:
- name: cache
path: /cache
settings:
restore: true
mount:
- node_modules
- .pnpm-store
-
- name: web_install_and_build
image: node:18.16-alpine
commands:
- npm install -g pnpm
- export NODE_OPTIONS=--max_old_space_size=4096
- pnpm install
- pnpm build
- pnpm build-admin
volumes:
- name: cache
path: /cache
- name: rebuild-cache
image: drillster/drone-volume-cache
volumes:
- name: cache
path: /cache
settings:
rebuild: true
mount:
- node_modules
- .pnpm-store
- name: scp
image: appleboy/drone-scp
pull: always
settings:
debug: true
source:
- build/web/
target:
from_secret: DRONE_DICT
host:
from_secret: DRONE_HOST
username:
from_secret: DRONE_NAME
port:
from_secret: DRONE_PORT
password:
from_secret: DRONE_PSW
when:
branch:
include:
- main
event:
- push
- merge
- name: scp-admin
image: appleboy/drone-scp
pull: always
settings:
debug: true
source:
- build/admin/
target:
from_secret: DRONE_DICT
host:
from_secret: DRONE_HOST
username:
from_secret: DRONE_NAME
port:
from_secret: DRONE_PORT
password:
from_secret: DRONE_PSW
when:
branch:
include:
- main
event:
- push
- merge
- name: ssh-front
pull: if-not-exists
image: appleboy/drone-ssh
settings:
host:
from_secret: DRONE_HOST
port:
from_secret: DRONE_PORT
username:
from_secret: DRONE_NAME
password:
from_secret: DRONE_PSW
script:
- nginx -s reload
- name: notify # 部署完成,邮件通知
pull: if-not-exists # 如果镜像不存在则拉取,免去每次都要重新下载
image: drillster/drone-email
settings:
recipients_only: true # 只发送给指定邮件收件人,不默认发送给流水线创建人
host: smtp.qq.com #SMTP服务器 例如 smtp.qq.com
port: 465 #SMTP服务端口 例如163邮箱端口465
subject: "Blog web Build Complete!"
username:
from_secret: SSH_EMAIL_USERNAME
password:
from_secret: SSH_EMAIL_PSW
from:
from_secret: SSH_EMAIL_USERNAME
recipients: 1369354176@qq.com #收件人邮箱
when: #执行条件
status:
- success
- changed
- failure
volumes:
- name: cache
host:
path: /usr/local/blog/cache/web
# 可限制哪些分支可以推送自动CICD
trigger:
branch:
include:
- main
event:
include:
- push