-
Notifications
You must be signed in to change notification settings - Fork 33
/
.drone.yml
executable file
·179 lines (160 loc) · 4.24 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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
kind: pipeline
name: default
steps:
- name: prepare
image: v7lin/flutter:1.17.3-stable
volumes:
- name: pub-cache
path: /opt/flutter/.pub-cache
commands:
- flutter packages get
#- name: build_runner
# image: v7lin/flutter:1.17.3-stable
# volumes:
# - name: pub-cache
# path: /opt/flutter/.pub-cache
# commands:
# - flutter pub run build_runner clean
# - flutter pub run build_runner build --delete-conflicting-outputs
# docker run --rm -it -v ${PWD}:/src v7lin/clang:5.0.2-r0 sh -c "clang-format -style=file -i src/Classes/*.h src/Classes/*.m"
#- name: ios-format
# image: v7lin/clang
# commands:
# - cd ios/
# - clang-format -style=file -i src/Classes/*.h src/Classes/*.m
- name: format
image: v7lin/flutter:1.17.3-stable
volumes:
- name: pub-cache
path: /opt/flutter/.pub-cache
commands:
- flutter format --dry-run --set-exit-if-changed .
- name: analyze
image: v7lin/flutter:1.17.3-stable
volumes:
- name: pub-cache
path: /opt/flutter/.pub-cache
commands:
- flutter analyze
- name: test
image: v7lin/flutter:1.17.3-stable
volumes:
- name: pub-cache
path: /opt/flutter/.pub-cache
commands:
- flutter test --coverage
# - cd example/
# - flutter test
- name: proguard
image: v7lin/flutter:1.17.3-stable
volumes:
- name: pub-cache
path: /opt/flutter/.pub-cache
- name: gradle
path: /root/.gradle
commands:
- cd example/
- flutter build apk
- name: coverage
image: plugins/codecov:2.0.3
settings:
token:
from_secret: CODECOV_TOKEN
files:
- ./coverage/lcov.info
when:
event:
exclude:
- pull_request
- name: publish-check
image: v7lin/flutter:1.17.3-stable
volumes:
- name: pub-cache
path: /opt/flutter/.pub-cache
commands:
- flutter packages pub publish --dry-run
volumes:
- name: pub-cache
temp: {}
- name: gradle
temp: {}
---
kind: pipeline
name: publish
steps:
- name: restore-cache
image: alpine:3.9.3
volumes:
- name: pub-cache
path: /opt/flutter/.pub-cache
commands:
- FLUTTER_HOME=/opt/flutter/.pub-cache
- wget -P $FLUTTER_HOME https://raw.githubusercontent.com/v7lin/pub_credentials/master/credentials.json.enc
- name: restore-cache-openssl
image: v7lin/openssl:1.1.1b
volumes:
- name: pub-cache
path: /opt/flutter/.pub-cache
environment:
ENC_METHOD:
from_secret: ENC_METHOD
ENC_PASSWORD:
from_secret: ENC_PASSWORD
commands:
- FLUTTER_HOME=/opt/flutter/.pub-cache
- openssl enc -d -$ENC_METHOD -k $ENC_PASSWORD -in $FLUTTER_HOME/credentials.json.enc -out $FLUTTER_HOME/credentials.json
- rm $FLUTTER_HOME/credentials.json.enc
- name: publish
image: v7lin/flutter:1.17.3-stable
volumes:
- name: pub-cache
path: /opt/flutter/.pub-cache
commands:
- echo "y" | flutter packages pub publish
- name: save-cache-openssl
image: v7lin/openssl:1.1.1b
volumes:
- name: pub-cache
path: /opt/flutter/.pub-cache
environment:
ENC_METHOD:
from_secret: ENC_METHOD
ENC_PASSWORD:
from_secret: ENC_PASSWORD
commands:
- FLUTTER_HOME=/opt/flutter/.pub-cache
- openssl enc -e -$ENC_METHOD -k $ENC_PASSWORD -in $FLUTTER_HOME/credentials.json -out $FLUTTER_HOME/credentials.json.enc
- rm /opt/flutter/.pub-cache/credentials.json
- name: save-cache
image: docker:git
volumes:
- name: pub-cache
path: /opt/flutter/.pub-cache
environment:
GIT_USER_EMAIL:
from_secret: GIT_USER_EMAIL
GIT_USER_NAME:
from_secret: GIT_USER_NAME
GIT_USER_PASSWORD:
from_secret: GIT_USER_PASSWORD # 密码含'@',用'%40'替换 -> URLEncoder.encode("@","utf-8");
commands:
- FLUTTER_HOME=/opt/flutter/.pub-cache
- git config --global user.email $GIT_USER_EMAIL
- git config --global user.name $GIT_USER_NAME
- git config --global credential.helper store
- git clone -b master https://$GIT_USER_NAME:[email protected]/v7lin/pub_credentials.git $FLUTTER_HOME/pub_credentials
- rm $FLUTTER_HOME/pub_credentials/credentials.json.enc
- mv $FLUTTER_HOME/credentials.json.enc $FLUTTER_HOME/pub_credentials/credentials.json.enc
- cd $FLUTTER_HOME/pub_credentials
- git commit -am "update credentials by ci/cd tools"
- git push
volumes:
- name: pub-cache
temp: {}
trigger:
status:
- success
event:
- tag
depends_on:
- default