Skip to content

fixing jq command docker-image.yml. #4

fixing jq command docker-image.yml.

fixing jq command docker-image.yml. #4

Workflow file for this run

name: "Docker build and push"
on:
push:
branches: [ "master" ]
jobs:
build_images:
name: "Building Images."
runs-on: ubuntu-22.04
steps:
- run: |
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
$($image)
done
docker_login:
name: "Login Docker."
runs-on: ubuntu-latest
steps:
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
docker_push:
name: "Pushing images to docker hub."
runs-on: ubuntu-22.04
steps:
- run: |
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
$($image)
done