8 Commits

Author SHA1 Message Date
hlaeja
47658b560b [RELEASE] - Release version: 0.11.0 2025-07-29 16:13:31 +00:00
439be2965d add GitHub action run checks 2025-07-29 18:00:20 +02:00
5a051a982d update Dependencies 2025-07-29 18:00:08 +02:00
a091bcd3c0 update gradlew 2025-07-28 19:09:45 +02:00
b005984904 add build info 2025-07-28 19:09:14 +02:00
61b9b5aed4 renaming hlaeja plugins 2025-07-28 19:08:32 +02:00
7400641843 update Dependencies 2025-07-28 19:08:32 +02:00
48e359d376 [RELEASE] - bump version 2025-04-05 12:35:49 +02:00
11 changed files with 138 additions and 177 deletions

12
.github/workflows/release.yml vendored Normal file
View File

@@ -0,0 +1,12 @@
name: Release
on:
workflow_dispatch:
jobs:
release:
uses: swordsteel/hlaeja-common-workflows/.github/workflows/release.yml@master
secrets:
CI_BOT_PAT: ${{ secrets.CI_BOT_PAT }}
with:
TYPE: catalog

12
.github/workflows/run-checks.yml vendored Normal file
View File

@@ -0,0 +1,12 @@
name: Pull request validation
on:
pull_request:
paths-ignore:
- '.github/**'
jobs:
validate:
uses: swordsteel/hlaeja-common-workflows/.github/workflows/run-checks.yml@master
secrets:
CI_BOT_PAT: ${{ secrets.CI_BOT_PAT }}

View File

@@ -4,7 +4,7 @@ A Version Catalog in Gradle is a centralized way to manage and reference depende
## Releasing version catalog. ## Releasing version catalog.
Run `release.sh` script from `master` branch. Run release pipeline from `master` branch.
## Publishing version catalog. ## Publishing version catalog.

View File

@@ -41,10 +41,24 @@ publishing {
} }
} }
tasks.register("clean") { tasks{
named("publishToMavenLocal") {
dependsOn("buildInfo")
}
register("clean") {
group = "build" group = "build"
doLast { doLast {
delete("${rootDir.path}/build") delete("${rootDir.path}/build")
println("Default Cleaning!") println("Default Cleaning!")
} }
}
register("buildInfo") {
group = "hlaeja"
description = "Prints the project name and version"
val projectName = project.name
val projectVersion = project.version
doLast {
println("Project Name: $projectName Version: $projectVersion")
}
}
} }

View File

@@ -1 +1 @@
version=0.10.0 version=0.11.0

Binary file not shown.

View File

@@ -1,6 +1,7 @@
#Thu Oct 17 08:20:06 BST 2024
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

47
gradlew vendored
View File

@@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# #
# SPDX-License-Identifier: Apache-2.0
#
############################################################################## ##############################################################################
# #
@@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop. # Darwin, MinGW, and NonStop.
# #
# (3) This script is generated from the Groovy template # (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project. # within the Gradle project.
# #
# You can find Gradle at https://github.com/gradle/gradle/. # You can find Gradle at https://github.com/gradle/gradle/.
@@ -80,13 +82,11 @@ do
esac esac
done done
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit # This is normally unused
# shellcheck disable=SC2034
APP_NAME="Gradle"
APP_BASE_NAME=${0##*/} APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value. # Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum MAX_FD=maximum
@@ -114,7 +114,7 @@ case "$( uname )" in #(
NONSTOP* ) nonstop=true ;; NONSTOP* ) nonstop=true ;;
esac esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar CLASSPATH="\\\"\\\""
# Determine the Java command to use to start the JVM. # Determine the Java command to use to start the JVM.
@@ -133,22 +133,29 @@ location of your Java installation."
fi fi
else else
JAVACMD=java JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the Please set the JAVA_HOME variable in your environment to match the
location of your Java installation." location of your Java installation."
fi
fi fi
# Increase the maximum file descriptors if we can. # Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #( case $MAX_FD in #(
max*) max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) || MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit" warn "Could not query maximum file descriptor limit"
esac esac
case $MAX_FD in #( case $MAX_FD in #(
'' | soft) :;; #( '' | soft) :;; #(
*) *)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" || ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD" warn "Could not set maximum file descriptor limit to $MAX_FD"
esac esac
@@ -193,18 +200,28 @@ if "$cygwin" || "$msys" ; then
done done
fi fi
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
# shell script including quotes and variable substitutions, so put them in DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded. # Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
set -- \ set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \ "-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \ -classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \ -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
"$@" "$@"
# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi
# Use "xargs" to parse quoted args. # Use "xargs" to parse quoted args.
# #
# With -n1 it outputs one arg per line, with the quotes and backslashes removed. # With -n1 it outputs one arg per line, with the quotes and backslashes removed.

41
gradlew.bat vendored
View File

@@ -13,8 +13,10 @@
@rem See the License for the specific language governing permissions and @rem See the License for the specific language governing permissions and
@rem limitations under the License. @rem limitations under the License.
@rem @rem
@rem SPDX-License-Identifier: Apache-2.0
@rem
@if "%DEBUG%" == "" @echo off @if "%DEBUG%"=="" @echo off
@rem ########################################################################## @rem ##########################################################################
@rem @rem
@rem Gradle startup script for Windows @rem Gradle startup script for Windows
@@ -25,7 +27,8 @@
if "%OS%"=="Windows_NT" setlocal if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0 set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=. if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0 set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME% set APP_HOME=%DIRNAME%
@@ -40,13 +43,13 @@ if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1 %JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute if %ERRORLEVEL% equ 0 goto execute
echo. echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. echo location of your Java installation. 1>&2
goto fail goto fail
@@ -56,32 +59,34 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute if exist "%JAVA_EXE%" goto execute
echo. echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. echo location of your Java installation. 1>&2
goto fail goto fail
:execute :execute
@rem Setup the command line @rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar set CLASSPATH=
@rem Execute Gradle @rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
:end :end
@rem End local scope for the variables with windows NT shell @rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd if %ERRORLEVEL% equ 0 goto mainEnd
:fail :fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code! rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 set EXIT_CODE=%ERRORLEVEL%
exit /b 1 if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd :mainEnd
if "%OS%"=="Windows_NT" endlocal if "%OS%"=="Windows_NT" endlocal

View File

@@ -1,31 +1,31 @@
[versions] [versions]
# kotlin version # kotlin version (detekt limit version)
kotlin = "2.0.10" kotlin = "2.0.21"
# plugin third party version # plugin third party version
arturboschDetektPlugin = "1.23.7" arturboschDetektPlugin = "1.23.8"
jlleitschuhKtlintPlugin = "12.1.1"
springframeworkBoot = "3.3.5"
bmuschkoDocker = "9.4.0" bmuschkoDocker = "9.4.0"
dependencyManagementPlugin = "1.1.7"
jlleitschuhKtlintPlugin = "12.3.0"
jsonwebtoken = "0.12.6" jsonwebtoken = "0.12.6"
springframeworkBoot = "3.5.4"
# hlaeja version # hlaeja version
hlaejaCorePlugin = "0.2.0" hlaejaCorePlugin = "0.3.0"
hlaejaCommonPlugin = "0.2.0" hlaejaCommonPlugin = "0.3.0"
hlaejaCommonMessages = "0.8.0" hlaejaCommonMessages = "0.9.0"
hlaejaJwt = "0.1.0" hlaejaJwt = "0.2.0"
hlaejaTest = "0.2.0" hlaejaTest = "0.3.0"
[libraries] [libraries]
influxdb-client-kotlin = { group = "com.influxdb", name = "influxdb-client-kotlin", version = "7.2.0" } influxdb-client-kotlin = { group = "com.influxdb", name = "influxdb-client-kotlin", version = "7.2.0" }
kotlin-logging = { group = "io.github.oshai", name = "kotlin-logging-jvm", version = "7.0.3" }
micrometer-registry-influx = { group = "io.micrometer", name = "micrometer-registry-influx", version = "1.14.2" }
fasterxml-jackson-module-kotlin = { group = "com.fasterxml.jackson.module", name = "jackson-module-kotlin" }
jjwt-api = { group = "io.jsonwebtoken", name = "jjwt-api", version.ref = "jsonwebtoken" } jjwt-api = { group = "io.jsonwebtoken", name = "jjwt-api", version.ref = "jsonwebtoken" }
jjwt-impl = { group = "io.jsonwebtoken", name = "jjwt-impl", version.ref = "jsonwebtoken" } jjwt-impl = { group = "io.jsonwebtoken", name = "jjwt-impl", version.ref = "jsonwebtoken" }
jjwt-jackson = { group = "io.jsonwebtoken", name = "jjwt-jackson", version.ref = "jsonwebtoken" } jjwt-jackson = { group = "io.jsonwebtoken", name = "jjwt-jackson", version.ref = "jsonwebtoken"}
kotlin-logging = { group = "io.github.oshai", name = "kotlin-logging-jvm", version = "7.0.7" }
fasterxml-jackson-module-kotlin = { group = "com.fasterxml.jackson.module", name = "jackson-module-kotlin" }
kotlin-reflect = { group = "org.jetbrains.kotlin", name = "kotlin-reflect" } kotlin-reflect = { group = "org.jetbrains.kotlin", name = "kotlin-reflect" }
kotlinx-coroutines = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-reactor" } kotlinx-coroutines = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-reactor" }
postgresql = { group = "org.postgresql", name = "postgresql" } postgresql = { group = "org.postgresql", name = "postgresql" }
@@ -46,8 +46,8 @@ springboot-starter-webflux = { group = "org.springframework.boot", name = "sprin
thymeleaf-spring-security = { group = "org.thymeleaf.extras", name = "thymeleaf-extras-springsecurity6" } thymeleaf-spring-security = { group = "org.thymeleaf.extras", name = "thymeleaf-extras-springsecurity6" }
# testing libraries # testing libraries
assertj-core = { group = "org.assertj", name = "assertj-core", version = "3.26.3" } assertj-core = { group = "org.assertj", name = "assertj-core", version = "3.27.3" }
mockk = { group = "io.mockk", name = "mockk", version = "1.13.13" } mockk = { group = "io.mockk", name = "mockk", version = "1.14.5" }
testcontainers-junit = { group = "org.testcontainers", name = "junit-jupiter" } testcontainers-junit = { group = "org.testcontainers", name = "junit-jupiter" }
testcontainers-postgresql = { group = "org.testcontainers", name = "postgresql" } testcontainers-postgresql = { group = "org.testcontainers", name = "postgresql" }
junit-jupiter-params = { group = "org.junit.jupiter", name = "junit-jupiter-params" } junit-jupiter-params = { group = "org.junit.jupiter", name = "junit-jupiter-params" }
@@ -59,7 +59,7 @@ projectreactor-reactor-test = { group = "io.projectreactor", name = "reactor-tes
springboot-starter-test = { group = "org.springframework.boot", name = "spring-boot-starter-test" } springboot-starter-test = { group = "org.springframework.boot", name = "spring-boot-starter-test" }
# plugin core dependencies # plugin core dependencies
org-eclipse-jgit = { group = "org.eclipse.jgit", name = "org.eclipse.jgit", version = "7.0.0.202409031743-r" } org-eclipse-jgit = { group = "org.eclipse.jgit", name = "org.eclipse.jgit", version = "7.3.0.202506031305-r" }
# plugin common dependencies # plugin common dependencies
com-bmuschko-docker-gradle-plugin = { group = "com.bmuschko", name = "gradle-docker-plugin", version.ref = "bmuschkoDocker" } com-bmuschko-docker-gradle-plugin = { group = "com.bmuschko", name = "gradle-docker-plugin", version.ref = "bmuschkoDocker" }
@@ -75,25 +75,24 @@ library-jwt = { group = "ltd.hlaeja.library", name = "hlaeja-jwt", version.ref =
library-test = { group = "ltd.hlaeja.library", name = "hlaeja-test", version.ref = "hlaejaTest" } library-test = { group = "ltd.hlaeja.library", name = "hlaeja-test", version.ref = "hlaejaTest" }
[plugins] [plugins]
spring-dependency-management = { id = "io.spring.dependency-management", version = "1.1.6" } gradle-detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "arturboschDetektPlugin" }
gradle-docker = { id = "com.bmuschko.docker-spring-boot-application", version.ref = "bmuschkoDocker" }
com-bmuschko-docker = { id = "com.bmuschko.docker-spring-boot-application", version.ref = "bmuschkoDocker" } gradle-ktlint = { id = "org.jlleitschuh.gradle.ktlint", version.ref = "jlleitschuhKtlintPlugin" }
io-gitlab-arturbosch-detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "arturboschDetektPlugin" }
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
kotlin-spring = { id = "org.jetbrains.kotlin.plugin.spring", version.ref = "kotlin" } kotlin-spring = { id = "org.jetbrains.kotlin.plugin.spring", version.ref = "kotlin" }
org-jlleitschuh-gradle-ktlint = { id = "org.jlleitschuh.gradle.ktlint", version.ref = "jlleitschuhKtlintPlugin" } spring-boot = { id = "org.springframework.boot", version.ref = "springframeworkBoot" }
springframework-boot = { id = "org.springframework.boot", version.ref = "springframeworkBoot" } spring-dependency-management = { id = "io.spring.dependency-management", version.ref = "dependencyManagementPlugin" }
# hlaeja plugin # hlaeja plugin
ltd-hlaeja-plugin-core = { id = "ltd.hlaeja.plugin.hlaeja-core-plugin", version.ref = "hlaejaCorePlugin" } core = { id = "ltd.hlaeja.plugin.hlaeja-core-plugin", version.ref = "hlaejaCorePlugin" }
ltd-hlaeja-plugin-common = { id = "ltd.hlaeja.plugin.hlaeja-common-plugin.common", version.ref = "hlaejaCommonPlugin" } common = { id = "ltd.hlaeja.plugin.hlaeja-common-plugin.common", version.ref = "hlaejaCommonPlugin" }
ltd-hlaeja-plugin-common-detekt = { id = "ltd.hlaeja.plugin.hlaeja-common-plugin.common-detekt", version.ref = "hlaejaCommonPlugin" } common-detekt = { id = "ltd.hlaeja.plugin.hlaeja-common-plugin.common-detekt", version.ref = "hlaejaCommonPlugin" }
ltd-hlaeja-plugin-common-ktlint = { id = "ltd.hlaeja.plugin.hlaeja-common-plugin.common-ktlint", version.ref = "hlaejaCommonPlugin" } common-ktlint = { id = "ltd.hlaeja.plugin.hlaeja-common-plugin.common-ktlint", version.ref = "hlaejaCommonPlugin" }
ltd-hlaeja-plugin-library = { id = "ltd.hlaeja.plugin.hlaeja-common-plugin.library", version.ref = "hlaejaCommonPlugin" } library = { id = "ltd.hlaeja.plugin.hlaeja-common-plugin.library", version.ref = "hlaejaCommonPlugin" }
ltd-hlaeja-plugin-library-manifest = { id = "ltd.hlaeja.plugin.hlaeja-common-plugin.library-manifest", version.ref = "hlaejaCommonPlugin" } library-manifest = { id = "ltd.hlaeja.plugin.hlaeja-common-plugin.library-manifest", version.ref = "hlaejaCommonPlugin" }
ltd-hlaeja-plugin-library-publish = { id = "ltd.hlaeja.plugin.hlaeja-common-plugin.library-publish", version.ref = "hlaejaCommonPlugin" } library-publish = { id = "ltd.hlaeja.plugin.hlaeja-common-plugin.library-publish", version.ref = "hlaejaCommonPlugin" }
ltd-hlaeja-plugin-service = { id = "ltd.hlaeja.plugin.hlaeja-common-plugin.service", version.ref = "hlaejaCommonPlugin" } service = { id = "ltd.hlaeja.plugin.hlaeja-common-plugin.service", version.ref = "hlaejaCommonPlugin" }
ltd-hlaeja-plugin-service-container = { id = "ltd.hlaeja.plugin.hlaeja-common-plugin.service-container", version.ref = "hlaejaCommonPlugin" } service-container = { id = "ltd.hlaeja.plugin.hlaeja-common-plugin.service-container", version.ref = "hlaejaCommonPlugin" }
ltd-hlaeja-plugin-service-integration-test = { id = "ltd.hlaeja.plugin.hlaeja-common-plugin.service-integration-test", version.ref = "hlaejaCommonPlugin" } service-integration-test = { id = "ltd.hlaeja.plugin.hlaeja-common-plugin.service-integration-test", version.ref = "hlaejaCommonPlugin" }
ltd-hlaeja-plugin-service-process-resource = { id = "ltd.hlaeja.plugin.hlaeja-common-plugin.service-process-resource", version.ref = "hlaejaCommonPlugin" } service-process-resource = { id = "ltd.hlaeja.plugin.hlaeja-common-plugin.service-process-resource", version.ref = "hlaejaCommonPlugin" }
ltd-hlaeja-plugin-certificate = { id = "ltd.hlaeja.plugin.hlaeja-common-plugin.certificate", version.ref = "hlaejaCommonPlugin" } certificate = { id = "ltd.hlaeja.plugin.hlaeja-common-plugin.certificate", version.ref = "hlaejaCommonPlugin" }

View File

@@ -1,99 +0,0 @@
#!/bin/sh
### This should be a pipeline, but for this example let use this ###
check_active_branch() {
if [ "$(git rev-parse --abbrev-ref HEAD)" != "$1" ]; then
echo "Error: The current branch is not $1."
exit 1
fi
}
check_uncommitted_changes() {
if [ -n "$(git status --porcelain)" ]; then
echo "Error: There are uncommitted changes in the repository."
exit 1
fi
}
prepare_environment() {
git fetch origin
}
check_last_commit() {
last_commit_message=$(git log -1 --pretty=format:%s)
if [ "$last_commit_message" = "[RELEASE] - bump version" ]; then
echo "Warning: Nothing to release!!!"
exit 1
fi
}
check_differences() {
if ! git diff --quiet origin/"$1" "$1"; then
echo "Error: The branches origin/$1 and $1 have differences."
exit 1
fi
}
un_snapshot_catalog() {
sed -i "s/^\($1\s*=\s*\"[0-9.]*\)-SNAPSHOT.*$/\1\"/" hlaeja.versions.toml
}
un_snapshot_version() {
sed -i "s/\($1\s*=\s*[0-9]\+\.[0-9]\+\.[0-9]\+\).*/\1/" gradle.properties
}
current_version() {
awk -F '=' '/version\s*=\s*[0-9.]*/ {gsub(/^ +| +$/,"",$2); print $2}' gradle.properties
}
stage_files() {
for file in "$@"; do
if git diff --exit-code --quiet -- "$file"; then
echo "No changes in $file"
else
git add "$file"
echo "Changes in $file staged for commit"
fi
done
}
commit_change() {
stage_files gradle.properties hlaeja.versions.toml
git commit -m "[RELEASE] - $1"
git push --porcelain origin master
}
add_release_tag() {
gitTag="v$(current_version)"
git tag -a "$gitTag" -m "Release version $gitTag"
git push --porcelain origin "$gitTag"
}
snapshot_version() {
new_version="$(current_version | awk -F '.' '{print $1 "." $2+1 ".0"}')"
sed -i "s/\(version\s*=\s*\)[0-9.]*/\1$new_version-SNAPSHOT/" gradle.properties
}
# check and prepare for release
check_active_branch master
check_uncommitted_changes
prepare_environment
check_last_commit
check_differences master
# un-snapshot catalog versions for release
un_snapshot_catalog "hlaejaCorePlugin"
un_snapshot_catalog "hlaejaCommonPlugin"
un_snapshot_catalog "hlaejaCommonMessages"
un_snapshot_catalog "hlaejaJwt"
un_snapshot_catalog "hlaejaTest"
# un-snapshot properties for release
un_snapshot_version version
# release changes and prepare for next release
commit_change "release version: $(current_version)"
add_release_tag
snapshot_version
commit_change 'bump version'