Skip to content

Commit c98971f

Browse files
committed
CI/Docker: push only if main, develop or tag, but always build
1 parent 0a7ead9 commit c98971f

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

.github/workflows/docker.yaml

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ name: OpenMina Docker Build
22
on:
33
workflow_dispatch: {}
44
push:
5-
branches: [ main, develop ]
6-
tags: [ "*" ]
75
paths-ignore:
86
- "helm/**"
97
- "*.md"
@@ -54,7 +52,12 @@ jobs:
5452
platforms: ${{ matrix.arch.platform }}
5553
cache-from: type=gha
5654
cache-to: type=gha,mode=max
57-
outputs: type=image,name=${{ env.REGISTRY_NODE_IMAGE }},push-by-digest=true,name-canonical=true,push=true
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/') }}
5861

5962
- name: Export digest
6063
run: |
@@ -72,6 +75,12 @@ jobs:
7275

7376
merge-openmina-node-image:
7477
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/')
7584
needs:
7685
- build-openmina-node-image
7786
steps:
@@ -155,7 +164,11 @@ jobs:
155164
BUILD_CONFIGURATION=${{ matrix.configuration.build_configuration }}
156165
cache-from: type=gha
157166
cache-to: type=gha,mode=max
158-
outputs: type=image,name=${{ env.REGISTRY_FRONTEND_IMAGE }},push-by-digest=true,name-canonical=true,push=true
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/') }}
159172

160173
- name: Export digest
161174
run: |
@@ -176,11 +189,8 @@ jobs:
176189
matrix:
177190
configuration:
178191
- build_configuration: production
179-
# - build_configuration: compose
180-
# tag_suffix: ""
181-
# - build_configuration: staging
182-
# tag_suffix: ""
183192
runs-on: ubuntu-latest
193+
if: github.ref_name == 'main' || github.ref_name == 'develop' || startsWith(github.ref, 'refs/tags/')
184194
needs:
185195
- build-openmina-frontend-image
186196
steps:
@@ -199,9 +209,6 @@ jobs:
199209
uses: docker/metadata-action@v5
200210
with:
201211
images: ${{ env.REGISTRY_FRONTEND_IMAGE }}
202-
# flavor: |
203-
# suffix=${{ matrix.configuration.tag_suffix }},onlatest=true
204-
# generate Docker tags based on the following events/attributes
205212
tags: |
206213
type=ref,event=branch
207214
type=sha,format=short

0 commit comments

Comments
 (0)