Skip to content

Commit 9485a49

Browse files
Merge pull request #3 from DeerHide/claude/manifest-build-config-Qd3UB
Refactor build script to use bash arrays instead of string concatenation
2 parents 4be3510 + 0dd5806 commit 9485a49

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

.github/workflows/release.yaml

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,33 +60,32 @@ jobs:
6060
IMAGE_FORMAT: ${{ steps.manifest.outputs.format }}
6161
run: |
6262
# Build args from manifest
63-
BUILD_ARGS=""
64-
for arg in $(yq e '.build.args[]' manifest.yaml); do
65-
BUILD_ARGS="${BUILD_ARGS} --build-arg ${arg}"
66-
done
63+
BUILD_ARGS=()
64+
while IFS= read -r arg; do
65+
BUILD_ARGS+=(--build-arg "${arg}")
66+
done < <(yq e '.build.args[]' manifest.yaml)
6767
6868
# Labels from manifest
69-
LABELS=""
69+
LABELS=()
7070
while IFS= read -r label; do
7171
if [[ -n "${label}" ]]; then
7272
label_key="${label%%=*}"
7373
label_value="${label#*=}"
7474
label_value="${label_value%\"}"
7575
label_value="${label_value#\"}"
76-
LABELS="${LABELS} --label ${label_key}=${label_value}"
76+
LABELS+=(--label "${label_key}=${label_value}")
7777
fi
7878
done < <(yq e '.build.labels[]' manifest.yaml)
7979
8080
# Add version label
81-
LABELS="${LABELS} --label org.opencontainers.image.version=${IMAGE_VERSION}"
81+
LABELS+=(--label "org.opencontainers.image.version=${IMAGE_VERSION}")
8282
83-
# shellcheck disable=SC2086
8483
buildah build \
8584
--squash \
8685
--pull-always \
8786
--format "${IMAGE_FORMAT}" \
88-
${BUILD_ARGS} \
89-
${LABELS} \
87+
"${BUILD_ARGS[@]}" \
88+
"${LABELS[@]}" \
9089
--tag "${IMAGE_NAME}:${IMAGE_VERSION}" \
9190
.
9291

0 commit comments

Comments
 (0)