Deploy Release #20
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: Deploy Release | |
on: | |
workflow_dispatch: | |
inputs: | |
branch: | |
description: 'The branch from which to deploy the release' | |
required: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
arch: | |
- amd64 | |
- arm64 | |
permissions: | |
contents: read | |
packages: write | |
name: Build Docker Images for ${{ matrix.arch }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.inputs.branch }} | |
token: ${{ secrets.RELEASE_TOKEN }} | |
- uses: actions/setup-java@v4 | |
with: | |
java-version: 17 | |
distribution: temurin | |
cache: maven | |
- name: Set Release Version & Image Tags | |
run: | | |
RELEASE_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) | |
KAFKA_VERSION=$(mvn help:evaluate -Dexpression=kafka.version -q -DforceStdout) | |
echo "BUILD_IMAGE_TAG=${RELEASE_VERSION}-kafka-${KAFKA_VERSION}" >> $GITHUB_ENV | |
echo "CONTAINER_REGISTRY=quay.io" >> $GITHUB_ENV | |
echo "CONTAINER_GROUP=ogunalp" >> $GITHUB_ENV | |
echo "LATEST_IMAGE_TAG=latest-kafka-${KAFKA_VERSION}" >> $GITHUB_ENV | |
echo "ADDITIONAL_TAG=latest" >> $GITHUB_ENV | |
- name: Set up QEMU | |
if: matrix.arch == 'arm64' | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: ${{ matrix.arch }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
install: true | |
- name: Build with Maven | |
run: | | |
mvn -s .github/ci-maven-settings.xml -B clean package -Dnative \ | |
-Dquarkus.native.additional-build-args=${{ matrix.arch == 'arm64' && '-H:PageSize=65536' || '-march=compatibility' }} \ | |
-Dquarkus.container-image.registry=${{ env.CONTAINER_REGISTRY }} \ | |
-Dquarkus.container-image.group=${{ env.CONTAINER_GROUP }} \ | |
-Dquarkus.native.container-build=true \ | |
-Dquarkus.native.container-runtime-options=--platform=linux/${{ matrix.arch }} \ | |
-Dquarkus.docker.buildx.platform=linux/${{ matrix.arch }} \ | |
-Dquarkus.container-image.build=true \ | |
-Dquarkus.container-image.push=false \ | |
-Dquarkus.container-image.tag=${{ env.BUILD_IMAGE_TAG }}-${{ matrix.arch }} \ | |
-Dquarkus.container-image.additional-tags=${{ env.ADDITIONAL_TAG }}-${{ matrix.arch }},${{ env.LATEST_IMAGE_TAG }}-${{ matrix.arch }} | |
- name: Integration Tests with Maven | |
run: | | |
mvn -s .github/ci-maven-settings.xml -B clean verify -Dtest-container \ | |
-Dkafka-native-container-image=${{ env.CONTAINER_REGISTRY }}/${{ env.CONTAINER_GROUP }}/kafka-native \ | |
-Dkafka-native-container-version=${{ env.BUILD_IMAGE_TAG }}-${{ matrix.arch }} \ | |
-Dzookeeper-native-container-image=${{ env.CONTAINER_REGISTRY }}/${{ env.CONTAINER_GROUP }}/zookeeper-native \ | |
-Dzookeeper-native-container-version=${{ env.BUILD_IMAGE_TAG }}-${{ matrix.arch }} | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.CONTAINER_REGISTRY }} | |
username: ${{ secrets.QUAY_USERNAME }} # ${{ github.actor }} | |
password: ${{ secrets.QUAY_ROBOT_TOKEN }} # ${{ secrets.GITHUB_TOKEN }} | |
- name: Push kafka-native images | |
working-directory: ${{ matrix.project.name }} | |
run: "docker push -a ${{ env.CONTAINER_REGISTRY }}/${{ env.CONTAINER_GROUP }}/kafka-native" | |
- name: Push zookeeper-native images | |
working-directory: ${{ matrix.project.name }} | |
run: "docker push -a ${{ env.CONTAINER_REGISTRY }}/${{ env.CONTAINER_GROUP }}/zookeeper-native" | |
create-multiarch-manifest: | |
needs: build | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
container: | |
- kafka-native | |
- zookeeper-native | |
permissions: | |
contents: read | |
packages: write | |
name: Create Multiarch Docker Images for ${{ matrix.container }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.inputs.branch }} | |
token: ${{ secrets.RELEASE_TOKEN }} | |
- uses: actions/setup-java@v4 | |
with: | |
java-version: 17 | |
distribution: temurin | |
cache: maven | |
- name: Set Release Version & Image Tags | |
run: | | |
RELEASE_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) | |
KAFKA_VERSION=$(mvn help:evaluate -Dexpression=kafka.version -q -DforceStdout) | |
echo "BUILD_IMAGE_TAG=${RELEASE_VERSION}-kafka-${KAFKA_VERSION}" >> $GITHUB_ENV | |
echo "CONTAINER_REGISTRY=quay.io" >> $GITHUB_ENV | |
echo "CONTAINER_GROUP=ogunalp" >> $GITHUB_ENV | |
echo "LATEST_IMAGE_TAG=latest-kafka-${KAFKA_VERSION}" >> $GITHUB_ENV | |
echo "ADDITIONAL_TAG=latest" >> $GITHUB_ENV | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.CONTAINER_REGISTRY }} | |
username: ${{ secrets.QUAY_USERNAME }} # ${{ github.actor }} | |
password: ${{ secrets.QUAY_ROBOT_TOKEN }} # ${{ secrets.GITHUB_TOKEN }} | |
- name: Create and push multi-arch manifests ${{ matrix.container }} | |
shell: bash | |
run: | | |
docker manifest create ${{ env.CONTAINER_REGISTRY }}/${{ env.CONTAINER_GROUP }}/${{ matrix.container }}:${{ env.BUILD_IMAGE_TAG }} \ | |
-a ${{ env.CONTAINER_REGISTRY }}/${{ env.CONTAINER_GROUP }}/${{ matrix.container }}:${{ env.BUILD_IMAGE_TAG }}-amd64 \ | |
-a ${{ env.CONTAINER_REGISTRY }}/${{ env.CONTAINER_GROUP }}/${{ matrix.container }}:${{ env.BUILD_IMAGE_TAG }}-arm64 | |
docker manifest push ${{ env.CONTAINER_REGISTRY }}/${{ env.CONTAINER_GROUP }}/${{ matrix.container }}:${{ env.BUILD_IMAGE_TAG }} | |
docker manifest create ${{ env.CONTAINER_REGISTRY }}/${{ env.CONTAINER_GROUP }}/${{ matrix.container }}:${{ env.ADDITIONAL_TAG }} \ | |
-a ${{ env.CONTAINER_REGISTRY }}/${{ env.CONTAINER_GROUP }}/${{ matrix.container }}:${{ env.ADDITIONAL_TAG }}-amd64 \ | |
-a ${{ env.CONTAINER_REGISTRY }}/${{ env.CONTAINER_GROUP }}/${{ matrix.container }}:${{ env.ADDITIONAL_TAG }}-arm64 | |
docker manifest push ${{ env.CONTAINER_REGISTRY }}/${{ env.CONTAINER_GROUP }}/${{ matrix.container }}:${{ env.ADDITIONAL_TAG }} | |
docker manifest create ${{ env.CONTAINER_REGISTRY }}/${{ env.CONTAINER_GROUP }}/${{ matrix.container }}:${{ env.LATEST_IMAGE_TAG }} \ | |
-a ${{ env.CONTAINER_REGISTRY }}/${{ env.CONTAINER_GROUP }}/${{ matrix.container }}:${{ env.LATEST_IMAGE_TAG }}-amd64 \ | |
-a ${{ env.CONTAINER_REGISTRY }}/${{ env.CONTAINER_GROUP }}/${{ matrix.container }}:${{ env.LATEST_IMAGE_TAG }}-arm64 | |
docker manifest push ${{ env.CONTAINER_REGISTRY }}/${{ env.CONTAINER_GROUP }}/${{ matrix.container }}:${{ env.LATEST_IMAGE_TAG }} | |
release-maven: | |
needs: create-multiarch-manifest | |
runs-on: ubuntu-latest | |
name: Release to Maven Central | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.inputs.branch }} | |
token: ${{ secrets.RELEASE_TOKEN }} | |
- uses: actions/setup-java@v4 | |
with: | |
java-version: 17 | |
distribution: temurin | |
cache: maven | |
server-id: ossrh | |
server-username: OSSRH_USERNAME # env variable for username in deploy | |
server-password: OSSRH_TOKEN # env variable for token in deploy | |
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} # Value of the GPG private key to import | |
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase | |
overwrite-settings: false | |
- name: Release | |
run: | | |
mvn -s .github/ci-maven-settings.xml -B \ | |
clean deploy -DskipTests -Prelease | |
env: | |
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} | |
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }} | |
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} |