Skip to content

Commit

Permalink
Generalize add-version.sh script to allow versioning other repos
Browse files Browse the repository at this point in the history
Closes keycloak#562

Signed-off-by: Jon Koops <[email protected]>
  • Loading branch information
jonkoops committed Feb 6, 2025
1 parent abf57c7 commit fc94575
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 36 deletions.
29 changes: 0 additions & 29 deletions add-version-client.sh

This file was deleted.

12 changes: 7 additions & 5 deletions add-version.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#!/bin/bash -e

VERSION=$1
ID=${2:-'keycloak'}

if [ "$VERSION" == "" ]; then
echo "usage: add-version.sh VERSION"
echo "usage: add-version.sh VERSION [ID]"
exit 1
fi

Expand All @@ -12,18 +14,18 @@ DATE=`date +%F`
if [[ "$VERSION" == *".0" ]]; then
TEMPLATE="version-template.json"
else
TEMPLATE="versions/keycloak/${VERSION%.*}.0.json"
TEMPLATE="versions/$ID/${VERSION%.*}.0.json"
fi

if [ ! -f "$TEMPLATE" ]; then
echo "$TEMPLATE not found"
exit
fi

cat $TEMPLATE | sed "s/\"version\":.*/\"version\": \"$VERSION\",/" | sed 's/"date": ".*"/"date": "DATE"/' | sed "s/DATE/$DATE/" > versions/keycloak/$VERSION_NAME.json
cat $TEMPLATE | sed "s/\"version\":.*/\"version\": \"$VERSION\",/" | sed 's/"date": ".*"/"date": "DATE"/' | sed "s/DATE/$DATE/" > versions/$ID/$VERSION_NAME.json

CURRENT=`cat pom.xml | grep '<version.keycloak>' | cut -d '>' -f 2 | cut -d '<' -f 1`
CURRENT=`cat pom.xml | grep "<version.$ID>" | cut -d '>' -f 2 | cut -d '<' -f 1`
LATEST=`echo -e "$CURRENT\n$VERSION" | sort -V -r | head -n 1`

mvn versions:set-property -Dproperty=version.keycloak -DnewVersion=$LATEST -DgenerateBackupPoms=false
mvn versions:set-property -Dproperty=version.$ID -DnewVersion=$LATEST -DgenerateBackupPoms=false
mvn install
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<version.commons-compress>1.26.0</version.commons-compress>

<version.keycloak>26.1.1</version.keycloak>
<version.keycloak.client>26.0.4</version.keycloak.client>
<version.keycloak-client>26.0.4</version.keycloak-client>
<version.keycloak-nodejs-connect>26.1.1</version.keycloak-nodejs-connect>

<version.frontend-maven-plugin>1.12.1</version.frontend-maven-plugin>
Expand Down Expand Up @@ -249,7 +249,7 @@
<artifactItem>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-client-guides</artifactId>
<version>${version.keycloak.client}</version>
<version>${version.keycloak-client}</version>
<classifier>asciidoc</classifier>
<type>zip</type>
<overWrite>true</overWrite>
Expand Down

0 comments on commit fc94575

Please sign in to comment.