-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy path.drone.yml
193 lines (168 loc) · 5.18 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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
kind: pipeline
type: docker
name: block_duplicated_pr_merged
steps:
- name: current_hollaex_cli_version
image: alpine
commands:
- export PACKAGE_VERSION="$(cat version)" && echo "$PACKAGE_VERSION" > .tags_current
- echo "Current Release tag is :" && cat .tags_current
- name: previous_hollaex_cli_version
image: byrnedo/alpine-curl
commands:
- curl https://raw.githubusercontent.com/bitholla/hollaex-cli/master/version > .tags_previous
- echo "The previous master release tag is :" && cat .tags_previous
- name: version_comparison
image: frolvlad/alpine-bash
commands:
- export TAGS_CURRENT=$(cat .tags_current) && export TAGS_PREVIOUS=$(cat .tags_previous) && if [ "$TAGS_PREVIOUS" == "$TAGS_CURRENT" ]; then echo "Blocking the merge since the versions are same..." && exit 1; else echo "Good to proceed"; fi
- name: slack_noti_job_end
image: plugins/slack
settings:
channel: deployment
webhook:
from_secret: slack_webhook
when:
status: [failure]
trigger:
branch:
- master
event:
- pull_request
---
kind: pipeline
type: docker
name: releaes_notification
steps:
- name: notify_job_start
image: plugins/slack
settings:
template: "<{{build.link}}|HollaEx CLI merge> - #{{build.number}} started on <https://github.com/{{repo.owner}}/{{repo.name}}/tree/{{build.branch}}|{{repo.name}} / {{build.branch}}> by {{build.author}}"
channel: deployment
environment:
SLACK_WEBHOOK:
from_secret: slack_webhook
- name: docker_tag_for_release_testnet
image: alpine
commands:
- export PACKAGE_VERSION="$(cat version)" && echo "$PACKAGE_VERSION-testnet" > .tags
- echo "Current Release tag is :" && cat .tags
when:
branch: testnet
# - name: dct_signing
# image: docker:20.10-dind
# privileged: true
# environment:
# DOCKER_USERNAME:
# from_secret: docker_username_yechan
# DOCKER_PASSWORD:
# from_secret: docker_password_yechan
# DOCKER_CONTENT_TRUST_REPOSITORY_PASSPHRASE:
# from_secret: DOCKER_CONTENT_TRUST_REPOSITORY_PASSPHRASE
# DOCKER_CONTENT_TRUST_PRIVATE_KEY:
# from_secret: DOCKER_CONTENT_TRUST_PRIVATE_KEY
# volumes:
# - name: docker
# path: /var/run/docker.sock
# commands:
# - docker login -u $${DOCKER_USERNAME} -p $${DOCKER_PASSWORD}
# - export DOCKER_CLI_EXPERIMENTAL=enabled
# - export PACKAGE_VERSION="$(cat version)" && echo "$PACKAGE_VERSION-develop" > .tags
# - docker pull bitholla/hollaex-cli:$(cat .tags)
# - export DOCKER_CONTENT_TRUST=1
# - mkdir $${HOME}/.docker/trust && mkdir $${HOME}/.docker/trust/private
# - echo -n $${DOCKER_CONTENT_TRUST_PRIVATE_KEY} | base64 -d > $${HOME}/.docker/trust/private/88ce8696c017268731701ad17ae8b59dda7c31a3b750e986282c66c74ecb0d32.key
# - chmod 600 $${HOME}/.docker/trust/private/88ce8696c017268731701ad17ae8b59dda7c31a3b750e986282c66c74ecb0d32.key
# - docker trust key load $${HOME}/.docker/trust/private/88ce8696c017268731701ad17ae8b59dda7c31a3b750e986282c66c74ecb0d32.key --name bitholla-cicd
# - docker trust sign bitholla/hollaex-cli:$(cat .tags)
- name: docker_tag_for_release_master
image: alpine
commands:
- export PACKAGE_VERSION="$(cat version)" && echo "$PACKAGE_VERSION" > .tags
- echo "Current Release tag is :" && cat .tags
when:
branch: master
- name: create_github_release
image: bitholla/devops-tools:drone_github_hub-2004241546
environment:
GITHUB_TOKEN:
from_secret: github_oauth2_token_for_releases
commands:
- apt-get update && apt-get install -y hub git
- hub release create -m "HollaEx CLI v$(cat .tags) Release" -t ${DRONE_BRANCH} $(cat .tags)
when:
branch: master
- name: notify_job_done
image: bitholla/devops-tools:drone_slack-8a15f61
channel: deployment
environment:
SLACK_WEBHOOK:
from_secret: slack_webhook
when:
status: [ success, failure ]
- name: notify_to_releases
image: bitholla/devops-tools:drone_partymaker-0.1.4
channel: deployment
environment:
WEBHOOK_URL:
from_secret: webhook_url
when:
status: [ success, failure ]
- name: notify_to_discord_releases
image: bitholla/devops-tools:drone_partymaker-0.1.5
channel: deployment
settings:
target: discord
release_name: hollaex-cli
environment:
WEBHOOK_URL:
from_secret: discord_webhook_url
when:
status: [ success, failure ]
branch: master
volumes:
- name: docker
host:
path: /var/run/docker.sock
trigger:
branch:
- master
- testnet
event:
- push
---
kind: secret
name: slack_webhook
get:
path: devops/data/drone-ci/secret
name: slack_webhook
---
kind: secret
name: webhook_url
get:
path: devops/data/drone-ci/secret
name: webhook_url
---
kind: secret
name: discord_webhook_url
get:
path: devops/data/drone-ci/secret
name: discord_webhook_url
---
kind: secret
name: github_oauth2_token_for_releases
get:
path: devops/data/drone-ci/secret
name: github_oauth2_token_for_releases
---
kind: secret
name: DOCKER_CONTENT_TRUST_REPOSITORY_PASSPHRASE
get:
path: devops/data/drone-ci/secret
name: DOCKER_CONTENT_TRUST_REPOSITORY_PASSPHRASE
---
kind: secret
name: DOCKER_CONTENT_TRUST_PRIVATE_KEY
get:
path: devops/data/drone-ci/secret
name: DOCKER_CONTENT_TRUST_PRIVATE_KEY