Skip to content

Commit cd1e132

Browse files
committed
refactor(ci): simplify tag formatting with reusable function
Signed-off-by: Dorin Geman <dorin.geman@docker.com>
1 parent 0c19994 commit cd1e132

File tree

1 file changed

+17
-42
lines changed

1 file changed

+17
-42
lines changed

.github/workflows/release.yml

Lines changed: 17 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -75,48 +75,23 @@ jobs:
7575
id: tags
7676
shell: bash
7777
run: |
78-
echo "cpu<<EOF" >> "$GITHUB_OUTPUT"
79-
echo "docker/model-runner:${{ inputs.releaseTag }}" >> "$GITHUB_OUTPUT"
80-
if [ "${{ inputs.pushLatest }}" == "true" ]; then
81-
echo "docker/model-runner:latest" >> "$GITHUB_OUTPUT"
82-
fi
83-
echo 'EOF' >> "$GITHUB_OUTPUT"
84-
echo "cuda<<EOF" >> "$GITHUB_OUTPUT"
85-
echo "docker/model-runner:${{ inputs.releaseTag }}-cuda" >> "$GITHUB_OUTPUT"
86-
if [ "${{ inputs.pushLatest }}" == "true" ]; then
87-
echo "docker/model-runner:latest-cuda" >> "$GITHUB_OUTPUT"
88-
fi
89-
echo 'EOF' >> "$GITHUB_OUTPUT"
90-
echo "vllm-cuda<<EOF" >> "$GITHUB_OUTPUT"
91-
echo "docker/model-runner:${{ inputs.releaseTag }}-vllm-cuda" >> "$GITHUB_OUTPUT"
92-
if [ "${{ inputs.pushLatest }}" == "true" ]; then
93-
echo "docker/model-runner:latest-vllm-cuda" >> "$GITHUB_OUTPUT"
94-
fi
95-
echo 'EOF' >> "$GITHUB_OUTPUT"
96-
echo "sglang-cuda<<EOF" >> "$GITHUB_OUTPUT"
97-
echo "docker/model-runner:${{ inputs.releaseTag }}-sglang-cuda" >> "$GITHUB_OUTPUT"
98-
if [ "${{ inputs.pushLatest }}" == "true" ]; then
99-
echo "docker/model-runner:latest-sglang-cuda" >> "$GITHUB_OUTPUT"
100-
fi
101-
echo 'EOF' >> "$GITHUB_OUTPUT"
102-
echo "rocm<<EOF" >> "$GITHUB_OUTPUT"
103-
echo "docker/model-runner:${{ inputs.releaseTag }}-rocm" >> "$GITHUB_OUTPUT"
104-
if [ "${{ inputs.pushLatest }}" == "true" ]; then
105-
echo "docker/model-runner:latest-rocm" >> "$GITHUB_OUTPUT"
106-
fi
107-
echo 'EOF' >> "$GITHUB_OUTPUT"
108-
echo "musa<<EOF" >> "$GITHUB_OUTPUT"
109-
echo "docker/model-runner:${{ inputs.releaseTag }}-musa" >> "$GITHUB_OUTPUT"
110-
if [ "${{ inputs.pushLatest }}" == "true" ]; then
111-
echo "docker/model-runner:latest-musa" >> "$GITHUB_OUTPUT"
112-
fi
113-
echo 'EOF' >> "$GITHUB_OUTPUT"
114-
echo "cann<<EOF" >> "$GITHUB_OUTPUT"
115-
echo "docker/model-runner:${{ inputs.releaseTag }}-cann" >> "$GITHUB_OUTPUT"
116-
if [ "${{ inputs.pushLatest }}" == "true" ]; then
117-
echo "docker/model-runner:latest-cann" >> "$GITHUB_OUTPUT"
118-
fi
119-
echo 'EOF' >> "$GITHUB_OUTPUT"
78+
format_tags() {
79+
local variant="$1"
80+
local suffix="${variant:+-$variant}" # empty for cpu, "-variant" otherwise
81+
echo "${variant:-cpu}<<EOF" >> "$GITHUB_OUTPUT"
82+
echo "docker/model-runner:${{ inputs.releaseTag }}${suffix}" >> "$GITHUB_OUTPUT"
83+
if [ "${{ inputs.pushLatest }}" == "true" ]; then
84+
echo "docker/model-runner:latest${suffix}" >> "$GITHUB_OUTPUT"
85+
fi
86+
echo 'EOF' >> "$GITHUB_OUTPUT"
87+
}
88+
format_tags "" # cpu
89+
format_tags "cuda"
90+
format_tags "vllm-cuda"
91+
format_tags "sglang-cuda"
92+
format_tags "rocm"
93+
format_tags "musa"
94+
format_tags "cann"
12095
12196
- name: Log in to DockerHub
12297
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef

0 commit comments

Comments
 (0)