Skip to content

Merge pull request #89 from nityatadepalli123/master #2

Merge pull request #89 from nityatadepalli123/master

Merge pull request #89 from nityatadepalli123/master #2

Workflow file for this run

name: Build & publish event-streams-samples images
on:
push:
branches: ['master']
paths:
- 'kafka-java-console-sample/**'
- 'kafka-mirrormaker/**'
- 'kafka-java-console-schema-sample/**'
- 'kafka-nodejs-console-sample/**'
- 'kafka-python-console-sample/**'
env:
REGISTRY: ghcr.io
jobs:
build-and-push-image:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- directory: kafka-java-console-sample
image: kafka-java-console-sample:latest
- directory: kafka-java-console-schema-sample
image: kafka-java-console-schema-sample:latest
- directory: kafka-mirrormaker
image: kafka-mirrormaker:latest
- directory: kafka-nodejs-console-sample
image: kafka-nodejs-console-sample:latest
- directory: kafka-python-console-sample
image: kafka-python-console-sample:latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin
- name: Build image
run: |
cd ${{ matrix.directory }}
docker build . --file Dockerfile --tag ${{ matrix.image }} --label "latest"
- name: Push image
run: |
IMAGE_ID=ghcr.io/${{ github.repository }}/${{ matrix.image }}
# This changes all uppercase characters to lowercase.
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
echo IMAGE_ID=$IMAGE_ID
docker tag ${{ matrix.image }} $IMAGE_ID
docker push $IMAGE_ID