Skip to content

Commit 07107a5

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

1 file changed

Lines changed: 22 additions & 23 deletions

File tree

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

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,27 @@ on:
33
push:
44
branches: [ "master" ]
55
jobs:
6-
build_images:
7-
name: "Building Images."
6+
build_and_push:
87
runs-on: ubuntu-22.04
98
steps:
10-
- run: |
11-
jq -r 'map(\"select(.build == true)\").\[\] | .stages\[\] as $stage | \"docker build --no-cache --target \($stage) -t \(.namespace)/\(.name):\(.tag)-\($stage|ascii_downcase) ./\(.path)\" | split(\"\n\") | .\[\]' versions.json | while read -r image; do
12-
$($image)
13-
done
14-
docker_login:
15-
name: "Login Docker."
16-
runs-on: ubuntu-latest
17-
steps:
18-
- name: Login to Docker Hub
19-
uses: docker/login-action@v3
20-
with:
21-
username: ${{ secrets.DOCKERHUB_USERNAME }}
22-
password: ${{ secrets.DOCKERHUB_TOKEN }}
23-
docker_push:
24-
name: "Pushing images to docker hub."
25-
runs-on: ubuntu-22.04
26-
steps:
27-
- run: |
28-
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
29-
$($image)
30-
done
9+
- name: Login to Docker Hub
10+
uses: docker/login-action@v3
11+
with:
12+
username: ${{ secrets.DOCKERHUB_USERNAME }}
13+
password: ${{ secrets.DOCKERHUB_TOKEN }}
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
- name: "Build images"
17+
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
24+
- name: "Push Images"
25+
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
29+

0 commit comments

Comments
 (0)