1- name : Openmina Docker Build
1+ name : OpenMina Docker Build
22on :
33 workflow_dispatch : {}
44 push :
5- branches : [ main, develop ]
6- tags : [ "*" ]
75 paths-ignore :
8- # - ".github/**"
9- - " .drone.yml"
106 - " helm/**"
117 - " *.md"
128 - " docs/**"
@@ -41,21 +37,31 @@ jobs:
4137
4238 - name : Login to Docker Hub
4339 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' }}
4441 with :
4542 username : ${{ secrets.DOCKERHUB_USERNAME }}
4643 password : ${{ secrets.DOCKERHUB_PASSWORD }}
4744
4845 - name : Set up Docker Buildx
4946 uses : docker/setup-buildx-action@v3
5047
51- - name : Build and push by digest
48+ - name : Build Docker image
5249 id : build
5350 uses : docker/build-push-action@v6
5451 with :
5552 context : .
5653 platforms : ${{ matrix.arch.platform }}
5754 cache-from : type=gha
5855 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
5965 outputs : type=image,name=${{ env.REGISTRY_NODE_IMAGE }},push-by-digest=true,name-canonical=true,push=true
6066
6167 - name : Export digest
7480
7581 merge-openmina-node-image :
7682 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' }}
7784 needs :
7885 - build-openmina-node-image
7986 steps :
@@ -140,14 +147,15 @@ jobs:
140147
141148 - name : Login to Docker Hub
142149 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' }}
143151 with :
144152 username : ${{ secrets.DOCKERHUB_USERNAME }}
145153 password : ${{ secrets.DOCKERHUB_PASSWORD }}
146154
147155 - name : Set up Docker Buildx
148156 uses : docker/setup-buildx-action@v3
149157
150- - name : Build and push by digest
158+ - name : Build Docker image
151159 id : build
152160 uses : docker/build-push-action@v6
153161 with :
@@ -157,6 +165,17 @@ jobs:
157165 BUILD_CONFIGURATION=${{ matrix.configuration.build_configuration }}
158166 cache-from : type=gha
159167 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
160179 outputs : type=image,name=${{ env.REGISTRY_FRONTEND_IMAGE }},push-by-digest=true,name-canonical=true,push=true
161180
162181 - name : Export digest
@@ -178,11 +197,8 @@ jobs:
178197 matrix :
179198 configuration :
180199 - build_configuration : production
181- # - build_configuration: compose
182- # tag_suffix: ""
183- # - build_configuration: staging
184- # tag_suffix: ""
185200 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' }}
186202 needs :
187203 - build-openmina-frontend-image
188204 steps :
@@ -201,9 +217,6 @@ jobs:
201217 uses : docker/metadata-action@v5
202218 with :
203219 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
207220 tags : |
208221 type=ref,event=branch
209222 type=sha,format=short
0 commit comments