@@ -37,27 +37,32 @@ jobs:
37
37
38
38
- name : Login to Docker Hub
39
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' }}
40
41
with :
41
42
username : ${{ secrets.DOCKERHUB_USERNAME }}
42
43
password : ${{ secrets.DOCKERHUB_PASSWORD }}
43
44
44
45
- name : Set up Docker Buildx
45
46
uses : docker/setup-buildx-action@v3
46
47
47
- - name : Build and push by digest
48
+ - name : Build Docker image
48
49
id : build
49
50
uses : docker/build-push-action@v6
50
51
with :
51
52
context : .
52
53
platforms : ${{ matrix.arch.platform }}
53
54
cache-from : type=gha
54
55
cache-to : type=gha,mode=max
55
- # :warning:
56
- # Push only if:
57
- # - main
58
- # - develop
59
- # - a tag
60
- outputs : type=image,name=${{ env.REGISTRY_NODE_IMAGE }},push-by-digest=true,name-canonical=true,push=${{ github.ref_name == 'main' || github.ref_name == 'develop' || startsWith(github.ref, 'refs/tags/') }}
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
65
+ outputs : type=image,name=${{ env.REGISTRY_NODE_IMAGE }},push-by-digest=true,name-canonical=true,push=true
61
66
62
67
- name : Export digest
63
68
run : |
75
80
76
81
merge-openmina-node-image :
77
82
runs-on : ubuntu-latest
78
- # :warning:
79
- # Only if:
80
- # - main
81
- # - develop
82
- # - a tag
83
- if : github.ref_name == 'main' || github.ref_name == 'develop' || startsWith(github.ref, 'refs/tags/')
83
+ if : ${{ (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/tags/')) && github.event_name == 'push' }}
84
84
needs :
85
85
- build-openmina-node-image
86
86
steps :
@@ -147,14 +147,15 @@ jobs:
147
147
148
148
- name : Login to Docker Hub
149
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' }}
150
151
with :
151
152
username : ${{ secrets.DOCKERHUB_USERNAME }}
152
153
password : ${{ secrets.DOCKERHUB_PASSWORD }}
153
154
154
155
- name : Set up Docker Buildx
155
156
uses : docker/setup-buildx-action@v3
156
157
157
- - name : Build and push by digest
158
+ - name : Build Docker image
158
159
id : build
159
160
uses : docker/build-push-action@v6
160
161
with :
@@ -164,11 +165,18 @@ jobs:
164
165
BUILD_CONFIGURATION=${{ matrix.configuration.build_configuration }}
165
166
cache-from : type=gha
166
167
cache-to : type=gha,mode=max
167
- # Only if:
168
- # - main
169
- # - develop
170
- # - a tag
171
- outputs : type=image,name=${{ env.REGISTRY_FRONTEND_IMAGE }},push-by-digest=true,name-canonical=true,push=${{ github.ref_name == 'main' || github.ref_name == 'develop' || startsWith(github.ref, 'refs/tags/') }}
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
179
+ outputs : type=image,name=${{ env.REGISTRY_FRONTEND_IMAGE }},push-by-digest=true,name-canonical=true,push=true
172
180
173
181
- name : Export digest
174
182
run : |
@@ -190,7 +198,7 @@ jobs:
190
198
configuration :
191
199
- build_configuration : production
192
200
runs-on : ubuntu-latest
193
- if : github.ref_name == 'main' || github.ref_name == 'develop' || startsWith(github.ref, 'refs/tags/')
201
+ if : ${{ ( github.ref == 'refs/heads/ main' || github.ref == 'refs/heads/ develop' || startsWith(github.ref, 'refs/tags/')) && github.event_name == 'push' }}
194
202
needs :
195
203
- build-openmina-frontend-image
196
204
steps :
0 commit comments