Skip to content

Commit 2e31112

Browse files
author
Felipe Almeida Baccaro
committed
fixing jq command docker-image.yml.
1 parent 07107a5 commit 2e31112

1 file changed

Lines changed: 8 additions & 9 deletions

File tree

‎.github/workflows/docker-image.yml‎

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,14 @@ jobs:
1515
uses: actions/checkout@v4
1616
- name: "Build images"
1717
run: |
18-
jq -r 'map(select(.build == true)).[]
19-
| .stages[] as $stage
20-
| \"docker build --no-cache --target \($stage) -t \(.namespace)/\(.name):\(.tag)-\($stage|ascii_downcase) ./\(.path) \"
21-
| split("\n") | .[]' versions.json | while read -r image; do
22-
$($image)
23-
done
18+
buildExpr='map(select(.build == true)).[] | .stages[] as $stage | "docker build --no-cache --target \($stage) -t \(.namespace)/\(.name):\(.tag)-\($stage|ascii_downcase) ./\(.path)" | split("\n") | .[]';
19+
jq -r "$buildExpr" versions.json | while read -r image; do
20+
$($image)
21+
done
2422
- name: "Push Images"
2523
run: |
26-
jq -r 'map(select(.build == true and .push == true)).[] | .stages[] as $stage | "docker push \(.namespace)/\(.name):\(.tag)-\($stage|ascii_downcase) " | split("\n") | .[]' versions.json | while read -r image; do
27-
$($image)
28-
done
24+
pushExpr='map(select(.build == true and .push == true)).[] | .stages[] as $stage | "docker push \(.namespace)/\(.name):\(.tag)-\($stage|ascii_downcase) " | split("\n") | .[]'
25+
jq -r "$pushExpr" versions.json | while read -r image; do
26+
$($image)
27+
done
2928

0 commit comments

Comments
 (0)