Skip to content

Commit 75ad5f6

Browse files
committed
Make version optional in artifact name
1 parent 52f5c06 commit 75ad5f6

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

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

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,16 @@ on:
2323
description: 'Unique artifact name prefix (to avoid overriding existing artifcats during parallel runs).'
2424
required: true
2525
type: string
26+
artifact_prev_name_add_version:
27+
description: 'Add version to artifact name to download.'
28+
required: false
29+
default: true
30+
type: boolean
31+
artifact_curr_name_add_version:
32+
description: 'Add version to artifact name to upload.'
33+
required: false
34+
default: true
35+
type: boolean
2636
has_refs:
2737
description: 'The ref build matrix as JSON string (list of git refs to build/deploy).'
2838
required: true
@@ -88,8 +98,16 @@ jobs:
8898
VERSION="${{ matrix.version }}"
8999
ARCH="$( echo "${{ matrix.arch }}" | sed 's|/|-|g' )"
90100
91-
NAME_PREV="${{ inputs.artifact_prefix }}-${PRE_HASH}-${VERSION}-${ARCH}-${{ inputs.stage_prev }}"
92-
NAME_CURR="${{ inputs.artifact_prefix }}-${PRE_HASH}-${VERSION}-${ARCH}-${{ inputs.stage }}"
101+
if [ "${{ inputs.artifact_prev_name_add_version }}" = "true" ]; then
102+
NAME_PREV="${{ inputs.artifact_prefix }}-${PRE_HASH}-${VERSION}-${ARCH}-${{ inputs.stage_prev }}"
103+
else
104+
NAME_PREV="${{ inputs.artifact_prefix }}-${PRE_HASH}-${ARCH}-${{ inputs.stage_prev }}"
105+
fi
106+
if [ "${{ inputs.artifact_curr_name_add_version }}" = "true" ]; then
107+
NAME_CURR="${{ inputs.artifact_prefix }}-${PRE_HASH}-${VERSION}-${ARCH}-${{ inputs.stage }}"
108+
else
109+
NAME_CURR="${{ inputs.artifact_prefix }}-${PRE_HASH}-${ARCH}-${{ inputs.stage }}"
110+
fi
93111
echo "::set-output name=prev::${NAME_PREV}"
94112
echo "::set-output name=curr::${NAME_CURR}"
95113

0 commit comments

Comments
 (0)