Skip to content

Commit 6772d41

Browse files
authored
ci(distroless): Add replace input (#456)
Only build & replace images when `replace` is passed as input.
1 parent 2f9ed8b commit 6772d41

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

.github/workflows/distroless_dart.yaml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ name: Distroless (Dart)
22

33
on:
44
workflow_dispatch:
5+
inputs:
6+
replace:
7+
description: Replace the existing distroless image
8+
type: boolean
9+
default: false
510
pull_request:
611
paths:
712
- 'apps/distroless/bin/list_sdks.dart'
@@ -113,7 +118,7 @@ jobs:
113118
- name: Build and Push Image (builder)
114119
id: build-push-builder
115120
# Only run if the builder image is needed or if the workflow is manually triggered
116-
if: steps.is_needed.outputs.builder == 'true' || github.event_name == 'workflow_dispatch'
121+
if: steps.is_needed.outputs.builder == 'true' || (github.event_name == 'workflow_dispatch' && inputs.replace == 'true')
117122
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # 6.18.0
118123
with:
119124
context: apps/distroless/dart/build
@@ -131,7 +136,7 @@ jobs:
131136
- name: Build and Push Image (runtime)
132137
id: build-push-runtime
133138
# Only run if the runtime image is needed or if the workflow is manually triggered
134-
if: steps.is_needed.outputs.runtime == 'true' || github.event_name == 'workflow_dispatch'
139+
if: steps.is_needed.outputs.runtime == 'true' || (github.event_name == 'workflow_dispatch' && inputs.replace == 'true')
135140
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # 6.18.0
136141
with:
137142
context: apps/distroless/dart/build

.github/workflows/distroless_flutter.yaml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ name: Distroless (Flutter)
22

33
on:
44
workflow_dispatch:
5+
inputs:
6+
replace:
7+
description: Replace the existing distroless image
8+
type: boolean
9+
default: false
510
pull_request:
611
paths:
712
- 'apps/distroless/bin/list_sdks.dart'
@@ -125,7 +130,7 @@ jobs:
125130
- name: Build and Push Image (engine)
126131
id: build-push-engine
127132
# Only run if the engine image is needed or if the workflow is triggered manually
128-
if: steps.is_needed.outputs.engine == 'true' || github.event_name == 'workflow_dispatch'
133+
if: steps.is_needed.outputs.engine == 'true' || (github.event_name == 'workflow_dispatch' && inputs.replace == 'true')
129134
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # 6.18.0
130135
with:
131136
context: apps/distroless/flutter/build
@@ -140,7 +145,7 @@ jobs:
140145
- name: Build and Push Image (builder)
141146
id: build-push-builder
142147
# Only run if the builder image is needed or if the workflow is triggered manually
143-
if: steps.is_needed.outputs.builder == 'true' || github.event_name == 'workflow_dispatch'
148+
if: steps.is_needed.outputs.builder == 'true' || (github.event_name == 'workflow_dispatch' && inputs.replace == 'true')
144149
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # 6.18.0
145150
with:
146151
context: apps/distroless/flutter/build
@@ -155,7 +160,7 @@ jobs:
155160
- name: Build and Push Image (runtime)
156161
id: build-push-runtime
157162
# Only run if the runtime image is needed or if the workflow is triggered manually
158-
if: steps.is_needed.outputs.runtime == 'true' || github.event_name == 'workflow_dispatch'
163+
if: steps.is_needed.outputs.runtime == 'true' || (github.event_name == 'workflow_dispatch' && inputs.replace == 'true')
159164
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # 6.18.0
160165
with:
161166
context: apps/distroless/flutter/build

0 commit comments

Comments
 (0)