Skip to content

trying to make GitHub action work. #21

trying to make GitHub action work.

trying to make GitHub action work. #21

Workflow file for this run

name: "Docker build and push"
on:
push:
branches: [ "master" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Checkout code
uses: actions/checkout@v4
- name: "Build images"
if: success()
run: |
jq -r 'map(select(.build == true)).[]
| .stages[] as $stage
| "docker build --no-cache --target \($stage) -t \(.namespace)/\(.repository):\(.tag)-\($stage|ascii_downcase) ./\(.path) "
| split("\n") | .[]' versions.json | while read -r image; do
$($image);
done
- name: "Push images"
if: success()
run: |
jq -r 'map(select(.build == true and .push == true)).[]
| .stages[] as $stage
| "docker push \(.namespace)/\(.repository):\(.tag)-\($stage|ascii_downcase)"
| split("\n") | .[]' versions.json | while read -r image; do
$($image);
done