Skip to content

Commit

Permalink
Updating set-version.sh and adding set-server-version.sh
Browse files Browse the repository at this point in the history
closes #639

Signed-off-by: mposolda <mposolda@gmail.com>
  • Loading branch information
mposolda committed Dec 5, 2024
1 parent 4fe2101 commit 161db54
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 32 deletions.
37 changes: 37 additions & 0 deletions set-server-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash -e

NEW_VERSION=$1

function updateNpmDep() {
FILE="$1"
PACKAGE="$2"

sed -i 's|"'"$PACKAGE"'": "[^"]*"|"'"$PACKAGE"'": "'"$NEW_VERSION"'"|g' $FILE
}

mvn versions:set-property -Dproperty=version.keycloak -DnewVersion=$NEW_VERSION -DgenerateBackupPoms=false

sed -i 's/ image:\(.*\):.*/ image:\1:'"$NEW_VERSION"'/g' kubernetes/keycloak.yaml
sed -i 's/ version: .*/ version: '"$NEW_VERSION"'/g' openshift/keycloak.yaml
sed -i 's/ image:\(.*\):.*/ image:\1:'"$NEW_VERSION"'/g' openshift/keycloak.yaml

if [[ $NEW_VERSION == "999.0.0-SNAPSHOT" ]]; then
# Use the nightly versions of adapters
NPM_ADMIN_CLIENT="https://github.com/keycloak/keycloak/releases/download/nightly/keycloak-admin-client-999.0.0-SNAPSHOT.tgz"
NPM_NODE_ADAPTER="https://github.com/keycloak/keycloak-nodejs-connect/releases/download/nightly/keycloak-nodejs-connect.tgz";
else
NPM_ADMIN_CLIENT=$NEW_VERSION
NPM_NODE_ADAPTER=$NEW_VERSION
fi

# JS quickstart
updateNpmDep js/spa/package.json "@keycloak/keycloak-admin-client"
updateNpmDep js/spa/package.json "keycloak-js"

# NodeJS quickstart
updateNpmDep nodejs/resource-server/package.json "@keycloak/keycloak-admin-client"
updateNpmDep nodejs/resource-server/package.json "keycloak-connect"

echo "New Mvn Version: $NEW_VERSION" >&2
echo "Used NPM dependency of keycloak-admin-client: $NPM_ADMIN_CLIENT" >&2
echo "Used NPM dependency of node-adapter: $NPM_NODE_ADAPTER" >&2
35 changes: 3 additions & 32 deletions set-version.sh
Original file line number Diff line number Diff line change
@@ -1,36 +1,7 @@
#!/bin/bash -e

NEW_VERSION=$1

function updateNpmDep() {
FILE="$1"
PACKAGE="$2"

sed -i 's|"'"$PACKAGE"'": "[^"]*"|"'"$PACKAGE"'": "'"$NEW_VERSION"'"|g' $FILE
}

mvn versions:set -Dversion.keycloak=$NEW_VERSION -DnewVersion=$NEW_VERSION -DgenerateBackupPoms=false -DgroupId=org.keycloak* -DartifactId=*
# Sets new version of the project in all pom.xml files

sed -i 's/\$\$VERSION\$\$/'"$NEW_VERSION"'/g' kubernetes/keycloak.yaml
sed -i 's/\$\$VERSION\$\$/'"$NEW_VERSION"'/g' openshift/keycloak.yaml

if [[ $NEW_VERSION == "999.0.0-SNAPSHOT" ]]; then
# Use the nightly versions of adapters
NPM_ADMIN_CLIENT="https://github.com/keycloak/keycloak/releases/download/nightly/keycloak-admin-client-999.0.0-SNAPSHOT.tgz"
NPM_NODE_ADAPTER="https://github.com/keycloak/keycloak-nodejs-connect/releases/download/nightly/keycloak-nodejs-connect.tgz";
else
NPM_ADMIN_CLIENT=$NEW_VERSION
NPM_NODE_ADAPTER=$NEW_VERSION
fi

# JS quickstart
updateNpmDep js/spa/package.json "@keycloak/keycloak-admin-client"
updateNpmDep js/spa/package.json "keycloak-js"

# NodeJS quickstart
updateNpmDep nodejs/resource-server/package.json "@keycloak/keycloak-admin-client"
updateNpmDep nodejs/resource-server/package.json "keycloak-connect"
NEW_VERSION=$1

echo "New Mvn Version: $NEW_VERSION" >&2
echo "Used NPM dependency of keycloak-admin-client: $NPM_ADMIN_CLIENT" >&2
echo "Used NPM dependency of node-adapter: $NPM_NODE_ADAPTER" >&2
mvn versions:set -DnewVersion=$NEW_VERSION -DgenerateBackupPoms=false -DgroupId=org.keycloak* -DartifactId=*

0 comments on commit 161db54

Please sign in to comment.