From 3d6021c41b187f22da4a5b1621fd02c26345d1e2 Mon Sep 17 00:00:00 2001 From: Maciej Swiderski Date: Sun, 23 Jun 2024 11:34:08 +0200 Subject: [PATCH] allow to push images to GH container image registry --- .github/workflows/maven-publish-arm64.yml | 23 ++++++++++++++++++++-- .github/workflows/maven-publish-native.yml | 19 +++++++++++++++++- pom.xml | 1 + 3 files changed, 40 insertions(+), 3 deletions(-) diff --git a/.github/workflows/maven-publish-arm64.yml b/.github/workflows/maven-publish-arm64.yml index 36fe32d..2a7373d 100644 --- a/.github/workflows/maven-publish-arm64.yml +++ b/.github/workflows/maven-publish-arm64.yml @@ -5,12 +5,18 @@ name: Build arm64 on: workflow_dispatch: - + inputs: + push-to-registry: + description: 'Push container to GH registry' + default: false + type: boolean jobs: build: runs-on: ubuntu-latest - + permissions: + contents: read + packages: write steps: - uses: actions/checkout@v4 - name: Set up JDK 17 @@ -21,3 +27,16 @@ jobs: cache: 'maven' - name: Build Automatiko Approval Tasks run: mvn -B package -Pcontainer-arm64 --file pom.xml + + + - name: login ghcr.io + if: inputs.push-to-registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + logout: true + - name: Build Automatiko Approval Tasks + if: inputs.push-to-registry + run: mvn -B package -Pcontainer-arm64 -Dquarkus.container-image.push=true -Dquarkus.container-image.registry=ghcr.io -Dquarkus.container-image.group=automatiko --file pom.xml diff --git a/.github/workflows/maven-publish-native.yml b/.github/workflows/maven-publish-native.yml index 7e63195..73e4b3c 100644 --- a/.github/workflows/maven-publish-native.yml +++ b/.github/workflows/maven-publish-native.yml @@ -5,7 +5,11 @@ name: Build Native on: workflow_dispatch: - + inputs: + push-to-registry: + description: 'Push container to GH registry' + default: false + type: boolean jobs: build: @@ -21,3 +25,16 @@ jobs: cache: 'maven' - name: Build Automatiko Approval Tasks run: mvn -B package -Pcontainer-native --file pom.xml + + - name: login ghcr.io + if: inputs.push-to-registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + logout: true + - name: Build Automatiko Approval Tasks + if: inputs.push-to-registry + run: mvn -B package -Pcontainer-native -Dquarkus.container-image.push=true -Dquarkus.container-image.registry=ghcr.io -Dquarkus.container-image.group=automatiko --file pom.xml + \ No newline at end of file diff --git a/pom.xml b/pom.xml index 3ac2a9b..ff8f427 100644 --- a/pom.xml +++ b/pom.xml @@ -215,6 +215,7 @@ true arm64v8/eclipse-temurin:17-ubi9-minimal + ${project.version}-arm64