From 6621fb3988c88e256409c6d2a7d662ce749cc93e Mon Sep 17 00:00:00 2001 From: andreaTP Date: Fri, 11 Mar 2022 16:19:30 +0000 Subject: [PATCH] Publish operator image to Quay --- .../workflows/release-operator-container.yml | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 .github/workflows/release-operator-container.yml diff --git a/.github/workflows/release-operator-container.yml b/.github/workflows/release-operator-container.yml new file mode 100644 index 0000000000..973ab5a5a0 --- /dev/null +++ b/.github/workflows/release-operator-container.yml @@ -0,0 +1,63 @@ +name: Release Keycloak Operator container + +on: + workflow_dispatch: + push: + tags: + - '[0-9]+.[0-9]+.[0-9]+' +concurrency: keycloak-operator-container-release + +env: + JDK_VERSION: 11 + +jobs: + publish: + if: github.repository == 'keycloak/keycloak' + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Container metadata + id: meta + uses: docker/metadata-action@v3 + with: + images: quay.io/keycloak/keycloak-operator + tags: | + type=ref,event=branch + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + + - name: Login to Quay + uses: docker/login-action@v1 + with: + registry: quay.io + username: ${{ secrets.QUAY_USERNAME }} + password: ${{ secrets.QUAY_TOKEN }} + + - uses: actions/setup-java@v1 + with: + java-version: ${{ env.JDK_VERSION }} + + - name: Cache Maven packages + id: cache + uses: actions/cache@v2 + with: + path: | + ~/.m2/repository + key: cache-1-${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} + restore-keys: cache-1-${{ runner.os }}-m2 + + - name: Build locally Keycloak artifacts to avoid depending on Maven + run: | + mvn -P operator -pl operator -am clean install -DskipTests + + - name: Build the operator Docker image + working-directory: operator + run: | + echo "${{ steps.meta.outputs.tags }}" | xargs -I {} \ + mvn clean package \ + -DskipTests \ + -Dquarkus.container-image.image={} \ + -Dquarkus.container-image.build=true \ + -Dquarkus.container-image.push=true