Skip to content

Commit bba56c0

Browse files
author
Felipe Almeida Baccaro
committed
dcarbone/install-jq-action github action.
1 parent 7a81207 commit bba56c0

1 file changed

Lines changed: 16 additions & 5 deletions

File tree

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

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,27 @@ jobs:
66
build_and_push:
77
runs-on: ubuntu-22.04
88
steps:
9-
- name: "Update Jq"
10-
run: sudo apt-get install --only-upgrade jq
9+
- name: "Install jq"
10+
uses: dcarbone/install-jq-action@v3
11+
with:
12+
version: '1.7.1'
1113
- name: Login to Docker Hub
1214
uses: docker/login-action@v3
1315
with:
1416
username: ${{ secrets.DOCKERHUB_USERNAME }}
1517
password: ${{ secrets.DOCKERHUB_TOKEN }}
1618
- name: Checkout code
1719
uses: actions/checkout@v4
18-
- name: "Build and Push"
20+
- name: "Build images"
21+
run: |
22+
buildExpr='map(select(.build == true)).[] | .stages[] as $stage | "docker build --no-cache --target \($stage) -t \(.namespace)/\(.repository):\(.tag)-\($stage|ascii_downcase) ./\(.path)" | split("\n") | .[]';
23+
jq -r "$buildExpr" versions.json | while read -r image; do
24+
$($image)
25+
done
26+
- name: "Push Images"
1927
run: |
20-
chmod +x ./versioning.sh
21-
./versioning.sh
28+
pushExpr='map(select(.build == true and .push == true)).[] | .stages[] as $stage | "docker push \(.namespace)/\(.repository):\(.tag)-\($stage|ascii_downcase) " | split("\n") | .[]'
29+
jq -r "$pushExpr" versions.json | while read -r image; do
30+
$($image)
31+
done
32+

0 commit comments

Comments
 (0)