diff --git a/.github/env/release-env b/.github/env/release-env
new file mode 100644
index 0000000..b02d3bf
--- /dev/null
+++ b/.github/env/release-env
@@ -0,0 +1,2 @@
+mvn-releases-url=https://s01.oss.sonatype.org/service/local/repositories/releases/content/
+mvn-snapshots-url=https://s01.oss.sonatype.org/content/repositories/snapshots/
\ No newline at end of file
diff --git a/.github/mvn-rel-settings.xml b/.github/mvn-rel-settings.xml
new file mode 100644
index 0000000..d1ecaad
--- /dev/null
+++ b/.github/mvn-rel-settings.xml
@@ -0,0 +1,38 @@
+
+
+
+
+ keycloak-rel
+
+
+
+ keycloak-rel
+
+
+ ${env.MAVEN_ID}
+ ${env.MAVEN_URL}
+
+ true
+
+
+ true
+
+
+
+
+
+
+
+ ${env.MAVEN_ID}
+ ${env.MAVEN_USERNAME}
+ ${env.MAVEN_PASSWORD}
+
+
+ gpg.passphrase
+ ${env.MAVEN_GPG_PASSPHRASE}
+
+
+
+
diff --git a/.github/workflows/release-nightly.yml b/.github/workflows/release-nightly.yml
new file mode 100644
index 0000000..3a3353d
--- /dev/null
+++ b/.github/workflows/release-nightly.yml
@@ -0,0 +1,32 @@
+name: Keycloak Client Nightly Release
+
+on:
+ schedule:
+ - cron: '0 2 * * *'
+ workflow_dispatch:
+
+jobs:
+ release:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Check out repository
+ uses: actions/checkout@v4
+
+ - name: Setup Java
+ uses: actions/setup-java@v4
+ with:
+ distribution: temurin
+ java-version: 17
+ server-id: ossrh
+ server-username: MAVEN_USERNAME
+ server-password: MAVEN_PASSWORD
+ gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
+ gpg-passphrase: MAVEN_GPG_PASSPHRASE
+
+ - name: Deploy to Maven
+ env:
+ MAVEN_USERNAME: ${{ secrets.MVN_USERNAME }}
+ MAVEN_PASSWORD: ${{ secrets.MVN_TOKEN }}
+ MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
+ run: |
+ mvn -nsu -B -Pgpg,jboss-release -DskipTests -DretryFailedDeploymentCount=10 -DautoReleaseAfterClose=true deploy
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 3a3353d..ce00995 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -1,32 +1,66 @@
-name: Keycloak Client Nightly Release
+name: Release
on:
- schedule:
- - cron: '0 2 * * *'
workflow_dispatch:
+ inputs:
+ branch:
+ description: Release branch (needed for major and minor releases)
+ required: true
+ version:
+ description: Release version
+ required: true
+ deploy-skip:
+ description: Set to true to prevent maven deploy plugin to actually deploy the artifacts.
+ required: true
+ default: false
+
+concurrency: rel-${{ github.ref }}
+
+defaults:
+ run:
+ shell: bash
jobs:
- release:
+
+ show-inputs:
runs-on: ubuntu-latest
steps:
- - name: Check out repository
+ - run: |
+ echo "Version: ${{ inputs.version }} " >> $GITHUB_STEP_SUMMARY
+ echo "Release branch: ${{ inputs.branch }} " >> $GITHUB_STEP_SUMMARY
+ echo "Workflow branch: ${{ github.ref_name }} " >> $GITHUB_STEP_SUMMARY
+ echo "Deploy skip: ${{ inputs.deploy-skip }} " >> $GITHUB_STEP_SUMMARY
+ - name: Checkout repository
uses: actions/checkout@v4
-
- - name: Setup Java
- uses: actions/setup-java@v4
with:
- distribution: temurin
- java-version: 17
- server-id: ossrh
- server-username: MAVEN_USERNAME
- server-password: MAVEN_PASSWORD
- gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
- gpg-passphrase: MAVEN_GPG_PASSPHRASE
-
- - name: Deploy to Maven
- env:
- MAVEN_USERNAME: ${{ secrets.MVN_USERNAME }}
- MAVEN_PASSWORD: ${{ secrets.MVN_TOKEN }}
- MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
- run: |
- mvn -nsu -B -Pgpg,jboss-release -DskipTests -DretryFailedDeploymentCount=10 -DautoReleaseAfterClose=true deploy
+ ref: ${{ inputs.branch }}
+
+ env:
+ uses: ./.github/workflows/x-env.yml
+
+ create-tags:
+ name: Create tags
+ needs: [env]
+ uses: ./.github/workflows/x-create-tags.yml
+ with:
+ tag: ${{ github.event.inputs.version }}
+ branch: ${{ github.event.inputs.branch }}
+ set-versions: true
+ secrets:
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+
+ keycloak-client:
+ name: Keycloak Client
+ needs: [env, create-tags]
+ uses: ./.github/workflows/x-keycloak-client.yml
+ with:
+ mvn-url: ${{ needs.env.outputs.mvn-releases-url }}
+ tag: ${{ github.event.inputs.version }}
+ deploy-skip: ${{ needs.env.outputs.deploy-skip }}
+ secrets:
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ MVN_USERNAME: ${{ secrets.MVN_USERNAME }}
+ MVN_TOKEN: ${{ secrets.MVN_TOKEN }}
+ GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
+ GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
+
diff --git a/.github/workflows/x-create-tags.yml b/.github/workflows/x-create-tags.yml
new file mode 100644
index 0000000..bbe9d2b
--- /dev/null
+++ b/.github/workflows/x-create-tags.yml
@@ -0,0 +1,51 @@
+
+name: X Create tags
+
+on:
+ workflow_call:
+ inputs:
+ tag:
+ required: true
+ type: string
+ branch:
+ required: false
+ type: string
+ default: main
+ set-versions:
+ required: false
+ type: boolean
+ default: false
+ secrets:
+ GH_TOKEN:
+ required: true
+
+defaults:
+ run:
+ shell: bash
+
+jobs:
+ create-tags:
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Create version commit
+ if: inputs.set-versions
+ run: |
+ ./set-version.sh ${{ inputs.tag }}
+ git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
+ git config --global user.name "github-actions[bot]"
+ git commit -a -m "Set version to ${{ inputs.tag }}"
+
+ - name: Tag commit
+ run: git tag --force ${{ inputs.tag }}
+
+ - name: Push changes
+ run: git push --force origin refs/tags/${{ inputs.tag }}
+
+ show-tags:
+ name: Show Git tags
+ runs-on: ubuntu-latest
+ needs: [create-tags]
+ steps:
+ - run: |
+ echo "https://github.com/keycloak/keycloak-client/tree/${{ inputs.tag }} " >> $GITHUB_STEP_SUMMARY
diff --git a/.github/workflows/x-env.yml b/.github/workflows/x-env.yml
new file mode 100644
index 0000000..ce87ed9
--- /dev/null
+++ b/.github/workflows/x-env.yml
@@ -0,0 +1,29 @@
+name: X Environment setup
+
+on:
+ workflow_call:
+ outputs:
+ mvn-releases-url:
+ description: "Maven Releases URL"
+ value: ${{ jobs.env.outputs.mvn-releases-url }}
+ mvn-snapshots-url:
+ description: "Maven Snapshots URL"
+ value: ${{ jobs.env.outputs.mvn-snapshots-url }}
+ deploy-skip:
+ value: ${{ jobs.env.outputs.depoly-skip }}
+
+defaults:
+ run:
+ shell: bash
+
+jobs:
+ env:
+ runs-on: ubuntu-latest
+ outputs:
+ mvn-releases-url: ${{ env.mvn-releases-url }}
+ mvn-snapshots-url: ${{ env.mvn-snapshots-url }}
+ deploy-skip: ${{ env.deploy-skip }}
+ steps:
+ - id: load-env
+ run: |
+ cat .github/env/release-env | sed -r '/^\s*$/d' >> $GITHUB_ENV
\ No newline at end of file
diff --git a/.github/workflows/x-keycloak-client.yml b/.github/workflows/x-keycloak-client.yml
new file mode 100644
index 0000000..9c4a433
--- /dev/null
+++ b/.github/workflows/x-keycloak-client.yml
@@ -0,0 +1,78 @@
+name: X Keycloak Client
+
+on:
+ workflow_call:
+ inputs:
+ mvn-url:
+ description: "Maven repository URL"
+ required: true
+ type: string
+ tag:
+ description: "Final tag for the release"
+ required: true
+ type: string
+ deploy-skip:
+ description: "To skip deploy to the maven repository set to 'true'"
+ required: false
+ type: string
+ default: false
+ path-final:
+ description: "Patch where the final tag will be checked out"
+ required: false
+ type: string
+ default: keycloak-client-final
+ secrets:
+ GH_TOKEN:
+ required: true
+ MVN_USERNAME:
+ required: true
+ MVN_TOKEN:
+ required: true
+ GPG_PASSPHRASE:
+ required: true
+ GPG_PRIVATE_KEY:
+ required: true
+
+defaults:
+ run:
+ shell: bash
+
+jobs:
+ release:
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Setup Java
+ uses: actions/setup-java@v4
+ with:
+ distribution: temurin
+ java-version: 17
+ server-id: kc-rel-repository
+ server-username: MAVEN_USERNAME
+ server-username: MAVEN_USERNAME
+ server-password: MAVEN_PASSWORD
+ gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
+ gpg-passphrase: MAVEN_GPG_PASSPHRASE
+
+ - name: Checkout Repository
+ uses: actions/checkout@v4
+ with:
+ path: ${{ inputs.path-final }}
+ ref: ${{ inputs.tag }}
+
+ - name: Deploy to Maven
+ env:
+ MAVEN_ID: kc-rel-repository
+ MAVEN_URL: ${{ inputs.mvn-url }}
+ MAVEN_USERNAME: ${{ secrets.MVN_USERNAME }}
+ MAVEN_PASSWORD: ${{ secrets.MVN_TOKEN }}
+ MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
+ run: |
+ MVN_HTTP_CONFIG="-Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3 -Dmaven.wagon.httpconnectionManager.ttlSeconds=120"
+ cd ${{ inputs.path-final }}
+ mvn -s ./.github/mvn-rel-settings.xml -nsu -B -Pgpg,jboss-release,all -Djboss.releases.repo.id=$MAVEN_ID -Dmaven.deploy.skip=${{ inputs.deploy-skip }} -Djboss.releases.repo.url=${{ inputs.mvn-url }} -Djboss.snapshots.repo.id=$MAVEN_ID -Djboss.snapshots.repo.url=${{ inputs.mvn-url }} -DskipTests -DskipTestsuite -DretryFailedDeploymentCount=10 -DautoReleaseAfterClose=true $MVN_HTTP_CONFIG clean deploy | tee deploy.log
+
+ - name: Show Maven artifacts
+ run: |
+ cd ${{ inputs.path-final }}
+ cat deploy.log | grep "Uploaded to" | grep -o "https://[^ ]*" | grep -v '.xml$' | grep -v '.asc$' | grep -v '.pom$' | grep -v 'javadoc.jar$' | grep -v 'sources.jar$' | xargs -I {} echo "{} " >> $GITHUB_STEP_SUMMARY
diff --git a/set-version.sh b/set-version.sh
new file mode 100755
index 0000000..3406c61
--- /dev/null
+++ b/set-version.sh
@@ -0,0 +1,8 @@
+#!/bin/bash -e
+
+NEW_VERSION=$1
+
+# Maven
+mvn versions:set -DnewVersion=$NEW_VERSION -DgenerateBackupPoms=false -DgroupId=org.keycloak* -DartifactId=*
+
+echo "New Mvn Version: $NEW_VERSION" >&2
diff --git a/testsuite/admin-client-tests/pom.xml b/testsuite/admin-client-tests/pom.xml
index 6383341..2c300de 100644
--- a/testsuite/admin-client-tests/pom.xml
+++ b/testsuite/admin-client-tests/pom.xml
@@ -21,4 +21,16 @@
+
+
+
+ org.apache.maven.plugins
+ maven-deploy-plugin
+
+ true
+
+
+
+
+
diff --git a/testsuite/authz-tests/pom.xml b/testsuite/authz-tests/pom.xml
index 81770b1..a936f3d 100644
--- a/testsuite/authz-tests/pom.xml
+++ b/testsuite/authz-tests/pom.xml
@@ -27,4 +27,16 @@
+
+
+
+ org.apache.maven.plugins
+ maven-deploy-plugin
+
+ true
+
+
+
+
+
\ No newline at end of file
diff --git a/testsuite/framework/pom.xml b/testsuite/framework/pom.xml
index d10353e..bd1cb93 100644
--- a/testsuite/framework/pom.xml
+++ b/testsuite/framework/pom.xml
@@ -42,4 +42,16 @@
+
+
+
+ org.apache.maven.plugins
+ maven-deploy-plugin
+
+ true
+
+
+
+
+
\ No newline at end of file
diff --git a/testsuite/pom.xml b/testsuite/pom.xml
index 8eaa80a..962d66f 100644
--- a/testsuite/pom.xml
+++ b/testsuite/pom.xml
@@ -37,6 +37,13 @@
+
+ org.apache.maven.plugins
+ maven-deploy-plugin
+
+ true
+
+