From ec7c397f549a60698e47a007c8bce083d095f51c Mon Sep 17 00:00:00 2001 From: Spencer Bliven Date: Tue, 10 Mar 2026 15:41:07 +0100 Subject: [PATCH 1/2] Revert "CI to build image and push to github registry (#17)" This reverts commit 7b70d3914b3b655e676995a70ae1a5d638b87dc6. --- .github/workflows/docker-build.yml | 72 ------------------------------ 1 file changed, 72 deletions(-) delete mode 100644 .github/workflows/docker-build.yml diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml deleted file mode 100644 index 52a9dd6..0000000 --- a/.github/workflows/docker-build.yml +++ /dev/null @@ -1,72 +0,0 @@ -name: Build and Push Docker Images - -on: - push: - branches: [ main ] - release: - types: [ published ] - -env: - REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository }} - -jobs: - build: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Set up JDK 17 - uses: actions/setup-java@v4 - with: - java-version: '17' - distribution: 'temurin' - - - name: Build with Maven - run: mvn clean package -DskipTests - - - name: Copy JAR to docker directory - run: | - rm -fv docker/plugins/*.jar - mkdir -p docker/plugins/ - cp -pv ./target/keycloak-facilities-admin-plugin-*.jar docker/plugins/ - - - name: Extract Keycloak version from pom.xml - id: version - run: | - VERSION=$(grep -oP '(?<=)[^<]+' pom.xml) - echo "keycloak_version=$VERSION" >> $GITHUB_OUTPUT - - - name: Log in to Container Registry - uses: docker/login-action@v3 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Extract metadata - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - tags: | - type=ref,event=branch - type=semver,pattern={{version}} - type=semver,pattern={{major}}.{{minor}} - - - name: Build and push Docker image - uses: docker/build-push-action@v5 - with: - context: ./docker - push: true - tags: | - ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest - ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }} - build-args: | - KEYCLOAK_IMAGE=quay.io/keycloak/keycloak:${{ steps.version.outputs.keycloak_version }} - labels: ${{ steps.meta.outputs.labels }} From 7e16bd911a43fe0a687a847d2e8793e6fe081602 Mon Sep 17 00:00:00 2001 From: Spencer Bliven Date: Tue, 10 Mar 2026 16:00:30 +0100 Subject: [PATCH 2/2] Improve image taging - Don't tag with run number (which conflict with patch versions - Tag with release version --- .github/workflows/maven.yml | 17 +++++++++++++---- pom.xml | 18 +++++++++--------- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index d354621..83cabf6 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -13,6 +13,8 @@ on: branches: [ "main" ] pull_request: branches: [ "main" ] + release: + types: [ published ] jobs: build: @@ -46,7 +48,14 @@ jobs: else eap="-eap" fi - mainVersion="1.0.$RUN_NUMBER" + + # Use release tag if available, otherwise parse from pom.xml + if [ -n "${RELEASE_TAG}" ] && [ "${RELEASE_TAG}" != "" ]; then + mainVersion="${RELEASE_TAG#v}" # Remove 'v' prefix if present + else + mainVersion="$(grep -m1 -oP '(?<=)[^<]+' pom.xml)" + fi + ver="$mainVersion-$keycloakVersion${eap}-$gitrev" echo "version=$ver" >>"$GITHUB_OUTPUT" echo "mainVersion=$mainVersion" >>"$GITHUB_OUTPUT" @@ -55,7 +64,7 @@ jobs: mvn --batch-mode versions:set "-DnewVersion=$ver" env: BRANCH_REF: ${{ github.ref }} - RUN_NUMBER: ${{ github.run_number }} + RELEASE_TAG: ${{ github.event.release.tag_name }} - name: Check for update of KeyCloak run: | newestKcVersion="$(curl https://api.github.com/repos/keycloak/keycloak/releases/latest | jq -r .name)" @@ -87,7 +96,7 @@ jobs: # https://docs.github.com/en/actions/use-cases-and-examples/publishing-packages/publishing-java-packages-with-maven - name: Publish to mvn artifact to GitHub Packages run: mvn --batch-mode deploy - if: github.ref == 'refs/heads/main' && github.event_name == 'push' + if: (github.ref == 'refs/heads/main' && github.event_name == 'push') || github.event_name == 'release' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - uses: actions/upload-artifact@v4 @@ -98,7 +107,7 @@ jobs: docker: needs: build runs-on: ubuntu-latest - if: github.ref == 'refs/heads/main' + if: (github.ref == 'refs/heads/main' && github.event_name == 'push') || github.event_name == 'release' env: REGISTRY: ghcr.io IMAGE_NAME: ${{ github.repository }} diff --git a/pom.xml b/pom.xml index 0b2a749..18feebe 100644 --- a/pom.xml +++ b/pom.xml @@ -4,6 +4,15 @@ ch.openem.keycloakadminhelperplugin keycloak-facilities-admin-plugin jar + 1.0.0-SNAPSHOT + keycloak-facilities-admin-plugin + http://maven.apache.org + + + + 26.5.4 + + @@ -65,15 +74,6 @@ - 1.0.0-rc2-SNAPSHOT - keycloak-facilities-admin-plugin - http://maven.apache.org - - - - 26.5.4 - -