34
34
run : |
35
35
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
36
36
37
- - name : Login to Docker Hub
38
- uses : docker/login-action@v3
39
- if : ${{ (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/tags/')) && github.event_name == 'push' }}
40
- with :
41
- username : ${{ secrets.DOCKERHUB_USERNAME }}
42
- password : ${{ secrets.DOCKERHUB_PASSWORD }}
43
-
44
37
- name : Set up Docker Buildx
45
38
uses : docker/setup-buildx-action@v3
46
39
54
47
cache-to : type=gha,mode=max
55
48
outputs : type=image,name=${{ env.REGISTRY_NODE_IMAGE }},push-by-digest=true,name-canonical=true,push=false
56
49
57
- - name : Push Docker image by digest
58
- if : ${{ (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/tags/')) && github.event_name == 'push' }}
59
- uses : docker/build-push-action@v6
60
- with :
61
- context : .
62
- platforms : ${{ matrix.arch.platform }}
63
- cache-from : type=gha
64
- outputs : type=image,name=${{ env.REGISTRY_NODE_IMAGE }},push-by-digest=true,name-canonical=true,push=true
65
-
66
50
- name : Export digest
67
51
run : |
68
52
mkdir -p /tmp/digests
77
61
if-no-files-found : error
78
62
retention-days : 1
79
63
80
- merge-openmina-node-image :
81
- runs-on : ubuntu-latest
82
- if : ${{ (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/tags/')) && github.event_name == 'push' }}
83
- needs :
84
- - build-openmina-node-image
85
- steps :
86
- - name : Download digests
87
- uses : actions/download-artifact@v4
88
- with :
89
- path : /tmp/digests
90
- pattern : node-digests-*
91
- merge-multiple : true
92
-
93
- - name : Set up Docker Buildx
94
- uses : docker/setup-buildx-action@v3
95
-
96
- - name : Docker meta
97
- id : meta
98
- uses : docker/metadata-action@v5
99
- with :
100
- images : ${{ env.REGISTRY_NODE_IMAGE }}
101
- # generate Docker tags based on the following events/attributes
102
- tags : |
103
- type=ref,event=branch
104
- type=sha,format=short
105
- type=semver,pattern={{version}},event=tag
106
- type=ref,event=tag
107
- type=raw,value=latest,enable=${{ github.ref_name == 'main' }}
108
-
109
- - name : Login to Docker Hub
110
- uses : docker/login-action@v3
111
- with :
112
- username : ${{ secrets.DOCKERHUB_USERNAME }}
113
- password : ${{ secrets.DOCKERHUB_PASSWORD }}
114
-
115
- - name : Create manifest list and push
116
- working-directory : /tmp/digests
117
- run : |
118
- docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
119
- $(printf '${{ env.REGISTRY_NODE_IMAGE }}@sha256:%s ' *)
120
-
121
- - name : Inspect image
122
- run : |
123
- docker buildx imagetools inspect ${{ env.REGISTRY_NODE_IMAGE }}:${{ steps.meta.outputs.version }}
124
-
125
64
# Frontend
126
-
127
65
build-openmina-frontend-image :
128
66
strategy :
129
67
matrix :
@@ -144,13 +82,6 @@ jobs:
144
82
- name : Git checkout
145
83
uses : actions/checkout@v4
146
84
147
- - name : Login to Docker Hub
148
- uses : docker/login-action@v3
149
- if : ${{ (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/tags/')) && github.event_name == 'push' }}
150
- with :
151
- username : ${{ secrets.DOCKERHUB_USERNAME }}
152
- password : ${{ secrets.DOCKERHUB_PASSWORD }}
153
-
154
85
- name : Set up Docker Buildx
155
86
uses : docker/setup-buildx-action@v3
156
87
@@ -166,17 +97,6 @@ jobs:
166
97
cache-to : type=gha,mode=max
167
98
outputs : type=image,name=${{ env.REGISTRY_FRONTEND_IMAGE }},push-by-digest=true,name-canonical=true,push=false
168
99
169
- - name : Push Docker image by digest
170
- if : ${{ (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/tags/')) && github.event_name == 'push' }}
171
- uses : docker/build-push-action@v6
172
- with :
173
- context : ./frontend
174
- platforms : ${{ matrix.arch.platform }}
175
- build-args : |
176
- BUILD_CONFIGURATION=${{ matrix.configuration.build_configuration }}
177
- cache-from : type=gha
178
- outputs : type=image,name=${{ env.REGISTRY_FRONTEND_IMAGE }},push-by-digest=true,name-canonical=true,push=true
179
-
180
100
- name : Export digest
181
101
run : |
182
102
mkdir -p /tmp/digests
@@ -190,52 +110,3 @@ jobs:
190
110
path : /tmp/digests/*
191
111
if-no-files-found : error
192
112
retention-days : 1
193
-
194
- merge-openmina-frontend-image :
195
- strategy :
196
- matrix :
197
- configuration :
198
- - build_configuration : production
199
- runs-on : ubuntu-latest
200
- if : ${{ (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/tags/')) && github.event_name == 'push' }}
201
- needs :
202
- - build-openmina-frontend-image
203
- steps :
204
- - name : Download digests
205
- uses : actions/download-artifact@v4
206
- with :
207
- path : /tmp/digests
208
- pattern : frontend-${{ matrix.configuration.build_configuration }}-digests-*
209
- merge-multiple : true
210
-
211
- - name : Set up Docker Buildx
212
- uses : docker/setup-buildx-action@v3
213
-
214
- - name : Docker meta
215
- id : meta
216
- uses : docker/metadata-action@v5
217
- with :
218
- images : ${{ env.REGISTRY_FRONTEND_IMAGE }}
219
- tags : |
220
- type=ref,event=branch
221
- type=sha,format=short
222
- type=semver,pattern={{version}},event=tag
223
- type=ref,event=tag
224
- type=raw,value=latest,enable=${{ github.ref_name == 'main' }}
225
- type=raw,value=staging,enable=${{ github.ref_name == 'develop' }}
226
-
227
- - name : Login to Docker Hub
228
- uses : docker/login-action@v3
229
- with :
230
- username : ${{ secrets.DOCKERHUB_USERNAME }}
231
- password : ${{ secrets.DOCKERHUB_PASSWORD }}
232
-
233
- - name : Create manifest list and push
234
- working-directory : /tmp/digests
235
- run : |
236
- docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
237
- $(printf '${{ env.REGISTRY_FRONTEND_IMAGE }}@sha256:%s ' *)
238
-
239
- - name : Inspect image
240
- run : |
241
- docker buildx imagetools inspect ${{ env.REGISTRY_FRONTEND_IMAGE }}:${{ steps.meta.outputs.version }}
0 commit comments