Skip to content

Strimzi Connect

Strimzi Connect #23

Workflow file for this run

name: Push Docker image to GitHub Packages
# This workflow runs when any of the following occur:
# - A push is made to a branch called `main` or `seed`
# - A tag starting with "v" is created
on:
push:
branches:
- main
- seed
tags:
- v*
env:
PROJECT: example-project
jobs:
push:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@v4
- name: Log in to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Build and push everything
run: |
cd csp1_producer
for DIR in strimzi_connect csp2_transformer csp1_producer csp1_consumer csp1_transformer csp2_producer dashboard ;do
IMAGE_NAME=$PROJECT/$DIR
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
[ "$VERSION" == "main" ] && VERSION=latest
echo "Building $IMAGE_NAME:$VERSION"
echo VERSION=$VERSION
cd ../$DIR
docker build . --tag $IMAGE_NAME --label "runnumber=${GITHUB_RUN_ID}"
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
echo "Pushing $IMAGE_ID:$VERSION"
docker push $IMAGE_ID:$VERSION
done