fixing jq command docker-image.yml. #4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |