This repository has been archived by the owner on Aug 2, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 463
249 lines (244 loc) · 9.25 KB
/
build-docker-images.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
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
name: Build Docker Images
on:
schedule:
- cron: "0 2 * * *"
workflow_dispatch:
jobs:
check-tokens:
name: "Check Docker Hub Token"
runs-on: ubuntu-18.04
steps:
- name: Check for DOCKERHUB_TOKEN
id: check_token
run: echo ::set-output name=token_exists::${HAS_SECRET}
env:
HAS_SECRET: ${{ secrets.DOCKERHUB_TOKEN != null }}
- name: Succeed job on existing DOCKERHUB_TOKEN
if: ${{ steps.check_token.outputs.token_exists == 'true' }}
uses: actions/github-script@v3
with:
script: |
core.setOutput('Success. DOCKERHUB_TOKEN is present in repository secrets.');
- name: Fail on missing DOCKERHUB_TOKEN
if: ${{ steps.check_token.outputs.token_exists == 'false' }}
uses: actions/github-script@v3
with:
script: |
core.setFailed('Failure: No DOCKERHUB_TOKEN present in repository secrets.');
build-docker-2_0_x:
name: Build Docker - nodeos release/2.0.x
runs-on: ubuntu-18.04
needs: check-tokens
steps:
- name: Checkout
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
with:
token: ${{ github.token }}
- name: Get nodeos sha
id: nodeos
uses: actions/github-script@v3
with:
script: |
const nodeosVersion = 'v2.0.';
const releaseList = await github.paginate('GET /repos/eosio/eos/releases');
const releases = releaseList.map(release => {
return {
tag: release.tag_name,
published_at: new Date(release.published_at),
};
})
.filter(release => release.tag.startsWith(nodeosVersion))
.sort((a, b) => b.published_at - a.published_at);
const tagList = await github.paginate('GET /repos/eosio/eos/tags');
const tag = tagList.filter(tag => tag.name === releases[0].tag);
return tag[0].commit.sha;
- name: Nodeos sha
id: nodeos-sha
run: |
SHA=$(echo "${NODEOS_SHA_FROM_JS}" | tr -d '"')
echo ::set-output name=NODEOS_SHA::${SHA}
env:
NODEOS_SHA_FROM_JS: ${{ steps.nodeos.outputs.result }}
- name: Set up QEMU
uses: docker/setup-qemu-action@27d0a4f181a40b142cce983c5393082c365d1480
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@0d135e0c2fc0dba0729c1a47ecfcf5a3c7f8579e
- name: Login to DockerHub
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: ./.github/eosjs-ci
file: ./.github/eosjs-ci/Dockerfile
pull: true
push: true
no-cache: true
build-args: |
EOSBRANCH=release_2.0.x
CDTBRANCH=release_1.7.x
tags: |
eosio/eosjs-ci:release_2.0.x
eosio/eosjs-ci:${{ steps.nodeos-sha.outputs.NODEOS_SHA }}
build-docker-2_1_x:
name: Build Docker - nodeos release/2.1.x
runs-on: ubuntu-18.04
needs: check-tokens
steps:
- name: Checkout
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
with:
token: ${{ github.token }}
- name: Get nodeos sha
id: nodeos
uses: actions/github-script@v3
with:
script: |
const nodeosVersion = 'v2.1.';
const releaseList = await github.paginate('GET /repos/eosio/eos/releases');
const releases = releaseList.map(release => {
return {
tag: release.tag_name,
published_at: new Date(release.published_at),
};
})
.filter(release => release.tag.startsWith(nodeosVersion))
.sort((a, b) => b.published_at - a.published_at);
const tagList = await github.paginate('GET /repos/eosio/eos/tags');
const tag = tagList.filter(tag => tag.name === releases[0].tag);
return tag[0].commit.sha;
- name: Nodeos sha
id: nodeos-sha
run: |
SHA=$(echo "${NODEOS_SHA_FROM_JS}" | tr -d '"')
echo ::set-output name=NODEOS_SHA::${SHA}
env:
NODEOS_SHA_FROM_JS: ${{ steps.nodeos.outputs.result }}
- name: Set up QEMU
uses: docker/setup-qemu-action@27d0a4f181a40b142cce983c5393082c365d1480
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@0d135e0c2fc0dba0729c1a47ecfcf5a3c7f8579e
- name: Login to DockerHub
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: ./.github/eosjs-ci
file: ./.github/eosjs-ci/Dockerfile
pull: true
push: true
no-cache: true
build-args: |
EOSBRANCH=release_2.1.x
CDTBRANCH=release_1.8.x
tags: |
eosio/eosjs-ci:release_2.1.x
eosio/eosjs-ci:${{ steps.nodeos-sha.outputs.NODEOS_SHA }}
build-docker-2_2_x:
name: Build Docker - nodeos release/2.2.x
runs-on: ubuntu-18.04
needs: check-tokens
steps:
- name: Checkout
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
with:
token: ${{ github.token }}
- name: Get nodeos sha
id: nodeos
uses: actions/github-script@v3
with:
script: |
const nodeosVersion = 'v2.2.';
const releaseList = await github.paginate('GET /repos/eosio/eos/releases');
const releases = releaseList.map(release => {
return {
tag: release.tag_name,
published_at: new Date(release.published_at),
};
})
.filter(release => release.tag.startsWith(nodeosVersion))
.sort((a, b) => b.published_at - a.published_at);
const tagList = await github.paginate('GET /repos/eosio/eos/tags');
const tag = tagList.filter(tag => tag.name === releases[0].tag);
return tag[0].commit.sha;
- name: Nodeos sha
id: nodeos-sha
run: |
SHA=$(echo "${NODEOS_SHA_FROM_JS}" | tr -d '"')
echo ::set-output name=NODEOS_SHA::${SHA}
env:
NODEOS_SHA_FROM_JS: ${{ steps.nodeos.outputs.result }}
- name: Set up QEMU
uses: docker/setup-qemu-action@c308fdd69d26ed66f4506ebd74b180abe5362145
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@0d135e0c2fc0dba0729c1a47ecfcf5a3c7f8579e
- name: Login to DockerHub
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@e1b7f96249f2e4c8e4ac1519b9608c0d48944a1f
with:
context: ./.github/eosjs-ci
file: ./.github/eosjs-ci/Dockerfile
pull: true
push: true
no-cache: true
build-args: |
EOSBRANCH=release_2.2.x
CDTBRANCH=release_1.8.x
tags: |
eosio/eosjs-ci:release_2.2.x
eosio/eosjs-ci:${{ steps.nodeos-sha.outputs.NODEOS_SHA }}
build-docker-develop:
name: Build Docker - nodeos develop
runs-on: ubuntu-18.04
needs: check-tokens
steps:
- name: Checkout
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
with:
token: ${{ github.token }}
- name: Get nodeos sha
id: nodeos
uses: actions/github-script@v3
with:
script: |
const developRef = await github.request('GET /repos/eosio/eos/git/refs/heads/develop');
return developRef.data.object.sha;
- name: Nodeos sha
id: nodeos-sha
run: |
SHA=$(echo "${NODEOS_SHA_FROM_JS}" | tr -d '"')
echo ::set-output name=NODEOS_SHA::${SHA}
env:
NODEOS_SHA_FROM_JS: ${{ steps.nodeos.outputs.result }}
- name: Set up QEMU
uses: docker/setup-qemu-action@c308fdd69d26ed66f4506ebd74b180abe5362145
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@0d135e0c2fc0dba0729c1a47ecfcf5a3c7f8579e
- name: Login to DockerHub
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@e1b7f96249f2e4c8e4ac1519b9608c0d48944a1f
with:
context: ./.github/eosjs-ci
file: ./.github/eosjs-ci/Dockerfile
pull: true
push: true
no-cache: true
build-args: |
EOSBRANCH=develop
CDTBRANCH=develop
tags: |
eosio/eosjs-ci:develop
eosio/eosjs-ci:${{ steps.nodeos-sha.outputs.NODEOS_SHA }}