1
- name : Openmina Docker Build
1
+ name : OpenMina Docker Build
2
2
on :
3
3
workflow_dispatch : {}
4
4
push :
5
- branches : [ main, develop ]
6
- tags : [ "*" ]
7
5
paths-ignore :
8
- # - ".github/**"
9
- - " .drone.yml"
10
6
- " helm/**"
11
7
- " *.md"
12
8
- " docs/**"
@@ -41,21 +37,31 @@ jobs:
41
37
42
38
- name : Login to Docker Hub
43
39
uses : docker/login-action@v3
40
+ if : ${{ (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/tags/')) && github.event_name == 'push' }}
44
41
with :
45
42
username : ${{ secrets.DOCKERHUB_USERNAME }}
46
43
password : ${{ secrets.DOCKERHUB_PASSWORD }}
47
44
48
45
- name : Set up Docker Buildx
49
46
uses : docker/setup-buildx-action@v3
50
47
51
- - name : Build and push by digest
48
+ - name : Build Docker image
52
49
id : build
53
50
uses : docker/build-push-action@v6
54
51
with :
55
52
context : .
56
53
platforms : ${{ matrix.arch.platform }}
57
54
cache-from : type=gha
58
55
cache-to : type=gha,mode=max
56
+ outputs : type=image,name=${{ env.REGISTRY_NODE_IMAGE }},push-by-digest=true,name-canonical=true,push=false
57
+
58
+ - name : Push Docker image by digest
59
+ if : ${{ (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/tags/')) && github.event_name == 'push' }}
60
+ uses : docker/build-push-action@v6
61
+ with :
62
+ context : .
63
+ platforms : ${{ matrix.arch.platform }}
64
+ cache-from : type=gha
59
65
outputs : type=image,name=${{ env.REGISTRY_NODE_IMAGE }},push-by-digest=true,name-canonical=true,push=true
60
66
61
67
- name : Export digest
74
80
75
81
merge-openmina-node-image :
76
82
runs-on : ubuntu-latest
83
+ if : ${{ (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/tags/')) && github.event_name == 'push' }}
77
84
needs :
78
85
- build-openmina-node-image
79
86
steps :
@@ -140,14 +147,15 @@ jobs:
140
147
141
148
- name : Login to Docker Hub
142
149
uses : docker/login-action@v3
150
+ if : ${{ (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/tags/')) && github.event_name == 'push' }}
143
151
with :
144
152
username : ${{ secrets.DOCKERHUB_USERNAME }}
145
153
password : ${{ secrets.DOCKERHUB_PASSWORD }}
146
154
147
155
- name : Set up Docker Buildx
148
156
uses : docker/setup-buildx-action@v3
149
157
150
- - name : Build and push by digest
158
+ - name : Build Docker image
151
159
id : build
152
160
uses : docker/build-push-action@v6
153
161
with :
@@ -157,6 +165,17 @@ jobs:
157
165
BUILD_CONFIGURATION=${{ matrix.configuration.build_configuration }}
158
166
cache-from : type=gha
159
167
cache-to : type=gha,mode=max
168
+ outputs : type=image,name=${{ env.REGISTRY_FRONTEND_IMAGE }},push-by-digest=true,name-canonical=true,push=false
169
+
170
+ - name : Push Docker image by digest
171
+ if : ${{ (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/tags/')) && github.event_name == 'push' }}
172
+ uses : docker/build-push-action@v6
173
+ with :
174
+ context : ./frontend
175
+ platforms : ${{ matrix.arch.platform }}
176
+ build-args : |
177
+ BUILD_CONFIGURATION=${{ matrix.configuration.build_configuration }}
178
+ cache-from : type=gha
160
179
outputs : type=image,name=${{ env.REGISTRY_FRONTEND_IMAGE }},push-by-digest=true,name-canonical=true,push=true
161
180
162
181
- name : Export digest
@@ -178,11 +197,8 @@ jobs:
178
197
matrix :
179
198
configuration :
180
199
- build_configuration : production
181
- # - build_configuration: compose
182
- # tag_suffix: ""
183
- # - build_configuration: staging
184
- # tag_suffix: ""
185
200
runs-on : ubuntu-latest
201
+ if : ${{ (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/tags/')) && github.event_name == 'push' }}
186
202
needs :
187
203
- build-openmina-frontend-image
188
204
steps :
@@ -201,9 +217,6 @@ jobs:
201
217
uses : docker/metadata-action@v5
202
218
with :
203
219
images : ${{ env.REGISTRY_FRONTEND_IMAGE }}
204
- # flavor: |
205
- # suffix=${{ matrix.configuration.tag_suffix }},onlatest=true
206
- # generate Docker tags based on the following events/attributes
207
220
tags : |
208
221
type=ref,event=branch
209
222
type=sha,format=short
0 commit comments