Skip to content

Commit 4811cd0

Browse files
committed
chore: Simplify Docker tag resolution and enhance ARM64 skip logic
1 parent 69e3b44 commit 4811cd0

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

.github/workflows/build-docker-images.yml

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,13 @@ jobs:
112112
steps:
113113
- name: Check if should skip (ARM64)
114114
id: should_skip
115+
env:
116+
MATRIX_NAME: ${{ matrix.name }}
117+
SKIP_ARM64: ${{ inputs.skip_arm64 }}
115118
run: |
116119
SKIP="false"
117120
# Skip ARM64 builds if requested
118-
if [[ "${{ matrix.name }}" == "linux-arm64" && "${{ inputs.skip_arm64 }}" == "true" ]]; then
121+
if [[ "$MATRIX_NAME" == "linux-arm64" && "$SKIP_ARM64" == "true" ]]; then
119122
SKIP="true"
120123
fi
121124
echo "skip=$SKIP" >> $GITHUB_OUTPUT
@@ -151,35 +154,32 @@ jobs:
151154
dockerfile: 'Dockerfile'
152155
cache-hit: '${{ steps.setup-java.outputs.cache-hit }}'
153156

154-
- name: Resolve Docker tag (publish amd64)
155-
if: steps.should_skip.outputs.skip != 'true' && matrix.docker_tag_input == 'tags_publish_amd64'
156-
id: resolve_tag_1
157-
run: |
158-
echo "tag=${{ inputs.tags_publish_amd64 }}" >> $GITHUB_OUTPUT
159-
- name: Resolve Docker tag (publish arm64)
160-
if: steps.should_skip.outputs.skip != 'true' && matrix.docker_tag_input == 'tags_publish_arm64'
161-
id: resolve_tag_2
162-
run: |
163-
echo "tag=${{ inputs.tags_publish_arm64 }}" >> $GITHUB_OUTPUT
164-
- name: Resolve Docker tag (minimal amd64)
165-
if: steps.should_skip.outputs.skip != 'true' && matrix.docker_tag_input == 'tags_minimal_amd64'
166-
id: resolve_tag_3
167-
run: |
168-
echo "tag=${{ inputs.tags_minimal_amd64 }}" >> $GITHUB_OUTPUT
169-
- name: Resolve Docker tag (minimal arm64)
170-
if: steps.should_skip.outputs.skip != 'true' && matrix.docker_tag_input == 'tags_minimal_arm64'
171-
id: resolve_tag_4
157+
- name: Resolve Docker tag
158+
if: steps.should_skip.outputs.skip != 'true'
159+
id: resolve_tag
172160
run: |
173-
echo "tag=${{ inputs.tags_minimal_arm64 }}" >> $GITHUB_OUTPUT
161+
case "${{ matrix.docker_tag_input }}" in
162+
tags_publish_amd64) TAG="${{ inputs.tags_publish_amd64 }}" ;;
163+
tags_publish_arm64) TAG="${{ inputs.tags_publish_arm64 }}" ;;
164+
tags_minimal_amd64) TAG="${{ inputs.tags_minimal_amd64 }}" ;;
165+
tags_minimal_arm64) TAG="${{ inputs.tags_minimal_arm64 }}" ;;
166+
*) TAG="local/openrouteservice:test" ;;
167+
esac
168+
echo "tag=$TAG" >> $GITHUB_OUTPUT
174169
175170
- name: Determine Docker output
176171
if: steps.should_skip.outputs.skip != 'true'
177172
id: output
173+
env:
174+
PUSH: ${{ inputs.push }}
175+
RUNNER_TEMP: ${{ runner.temp }}
176+
MATRIX_NAME: ${{ matrix.name }}
177+
MATRIX_STAGE: ${{ matrix.image_stage }}
178178
run: |
179-
if [ "${{ inputs.push }}" == "true" ]; then
179+
if [ "$PUSH" == "true" ]; then
180180
echo "output=type=image,push=true" >> $GITHUB_OUTPUT
181181
else
182-
echo "output=type=docker,dest=${{ runner.temp }}/image-${{ matrix.name }}-${{ matrix.image_stage }}.tar" >> $GITHUB_OUTPUT
182+
echo "output=type=docker,dest=$RUNNER_TEMP/image-$MATRIX_NAME-$MATRIX_STAGE.tar" >> $GITHUB_OUTPUT
183183
fi
184184
185185
- name: Build ${{ matrix.image_stage }} image stage for ${{ matrix.name }}
@@ -191,7 +191,7 @@ jobs:
191191
target: ${{ matrix.image_stage }}
192192
push: ${{ inputs.push }}
193193
load: false
194-
tags: ${{ steps.resolve_tag_1.outputs.tag || steps.resolve_tag_2.outputs.tag || steps.resolve_tag_3.outputs.tag || steps.resolve_tag_4.outputs.tag || 'local/openrouteservice:test' }}
194+
tags: ${{ steps.resolve_tag.outputs.tag }}
195195
platforms: "${{ matrix.platform }}"
196196
cache-from: type=${{ inputs.cache_from_type }}
197197
cache-to: type=${{ inputs.cache_from_type }},mode=max

0 commit comments

Comments
 (0)