Merge pull request #92 from nityatadepalli123/master #5
This file contains 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: 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/**' | |
- 'kafka-java-liberty-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 | |
- directory: kafka-java-liberty-sample | |
image: kafka-java-liberty-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 |