Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

Read OpenRemote version from Gradle version catalog (#3065)

Wouter Bornf667c603a447
diff --git a/.ci_cd/README.md b/.ci_cd/README.md
index f1b18b488..0ce4bfefd 100644
--- a/.ci_cd/README.md
+++ b/.ci_cd/README.md
@@ -20,7 +20,7 @@ docker image tag updates. The file layout is:
},
// Singleton or array of deployments to execute, a deployment consists of (environment and/or managerTag see variables for explanation)
"deploy": {
- "managerTag": "develop", // Can use #ref or exclude this to build COMMIT specific manager docker image (i.e. don't use an image from docker hub) for custom projects will always use openremoteVersion
+ "managerTag": "develop", // Can use #ref or exclude this to build COMMIT specific manager docker image (i.e. don't use an image from docker hub) for custom projects will always use openremote version from gradle/libs.versions.toml
"environment": "staging"
}
},
@@ -40,7 +40,7 @@ docker image tag updates. The file layout is:
},
// Singleton or array of deployments to execute, a deployment consists of (environment and/or managerTag see variables for explanation)
"deploy": {
- "managerTag": "latest", // Can use #ref or exclude this to build COMMIT specific manager docker image (i.e. don't use an image from docker hub) for custom projects will always use openremoteVersion
+ "managerTag": "latest", // Can use #ref or exclude this to build COMMIT specific manager docker image (i.e. don't use an image from docker hub) for custom projects will always use openremote version from gradle/libs.versions.toml
"environment": "production"
}
}
diff --git a/.github/actions/check-if-main-repo/action.yml b/.github/actions/check-if-main-repo/action.yml
index 7b2b8eb79..38ae12e06 100644
--- a/.github/actions/check-if-main-repo/action.yml
+++ b/.github/actions/check-if-main-repo/action.yml
@@ -30,10 +30,20 @@ runs:
echo "value=false" >> $GITHUB_OUTPUT
echo "repository=$(sed -E 's#(.+)/.+#\1/openremote#' <<< $GITHUB_REPOSITORY)" >> $GITHUB_OUTPUT
- version=$(cat gradle.properties | grep openremoteVersion | sed -E 's#.+=(.+)#\1#' | xargs)
+ version=""
+ if [ -f gradle/libs.versions.toml ]; then
+ version=$(sed -nE 's/^[[:space:]]*openremote[[:space:]]*=[[:space:]]*"([^"]+)".*$/\1/p' gradle/libs.versions.toml)
+ fi
+
+ if [ -z "$version" ] && [ -f gradle.properties ]; then
+ version=$(sed -nE 's/^[[:space:]]*openremoteVersion[[:space:]]*=[[:space:]]*([^[:space:]]+)[[:space:]]*$/\1/p' gradle.properties)
+ if [ -n "$version" ]; then
+ echo "::warning file=gradle.properties,title=Deprecated version configuration::Move openremoteVersion from gradle.properties to openremote in gradle/libs.versions.toml"
+ fi
+ fi
if [ -z "$version" ]; then
- echo "openremoteVersion must be set in gradle.properties"
+ echo "::error::openremote version must be set in gradle/libs.versions.toml"
exit 1
fi
diff --git a/.github/actions/process-cicd-json/action.yml b/.github/actions/process-cicd-json/action.yml
index 53ff4a1bf..79a6aa5b9 100644
--- a/.github/actions/process-cicd-json/action.yml
+++ b/.github/actions/process-cicd-json/action.yml
@@ -121,14 +121,14 @@ runs:
if isMainRepo:
deployStr += deploy['managerTag']
else:
- # Custom projects manager docker image must match the openremoteVersion from gradle.properties
+ # Custom projects manager docker image must match the openremote version from gradle/libs.versions.toml
deployStr += managerVersion
else:
if isMainRepo:
os.system("echo 'Manager tag not specified so using commit SHA'")
deployStr += managerTagDefault
else:
- # Custom projects manager docker image must match the openremoteVersion from gradle.properties
+ # Custom projects manager docker image must match the openremote version from gradle/libs.versions.toml
deployStr += managerVersion
deployStr += ";"
diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml
index ee51629a3..23b7f439c 100644
--- a/.github/workflows/ci_cd.yml
+++ b/.github/workflows/ci_cd.yml
@@ -227,10 +227,20 @@ jobs:
echo "value=false" >> $GITHUB_OUTPUT
echo "repository=$(sed -E 's#(.+)/.+#\1/openremote#' <<< $GITHUB_REPOSITORY)" >> $GITHUB_OUTPUT
- version=$(cat gradle.properties | grep openremoteVersion | sed -E 's#.+=(.+)#\1#' | xargs)
+ version=""
+ if [ -f gradle/libs.versions.toml ]; then
+ version=$(sed -nE 's/^[[:space:]]*openremote[[:space:]]*=[[:space:]]*"([^"]+)".*$/\1/p' gradle/libs.versions.toml)
+ fi
+
+ if [ -z "$version" ] && [ -f gradle.properties ]; then
+ version=$(sed -nE 's/^[[:space:]]*openremoteVersion[[:space:]]*=[[:space:]]*([^[:space:]]+)[[:space:]]*$/\1/p' gradle.properties)
+ if [ -n "$version" ]; then
+ echo "::warning file=gradle.properties,title=Deprecated version configuration::Move openremoteVersion from gradle.properties to openremote in gradle/libs.versions.toml"
+ fi
+ fi
if [ -z "$version" ]; then
- echo "openremoteVersion must be set in gradle.properties"
+ echo "::error::openremote version must be set in gradle/libs.versions.toml"
exit 1
fi
@@ -386,14 +396,14 @@ jobs:
if isMainRepo:
deployStr += deploy['managerTag']
else:
- # Custom projects manager docker image must match the openremoteVersion from gradle.properties
+ # Custom projects manager docker image must match the openremote version from gradle/libs.versions.toml
deployStr += managerVersion
else:
if isMainRepo:
os.system("echo 'Manager tag not specified so using commit SHA'")
deployStr += managerTagDefault
else:
- # Custom projects manager docker image must match the openremoteVersion from gradle.properties
+ # Custom projects manager docker image must match the openremote version from gradle/libs.versions.toml
deployStr += managerVersion
deployStr += ";"
diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
index 194b78ef7..f1a80cf4f 100644
--- a/.github/workflows/deploy.yml
+++ b/.github/workflows/deploy.yml
@@ -41,7 +41,7 @@ jobs:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Check if main repo
id: is_main_repo
- uses: openremote/openremote/.github/actions/check-if-main-repo@fa6f52032b1dea3d4ad080cc6436a3ef3843b0be
+ uses: openremote/openremote/.github/actions/check-if-main-repo@5beec5454f28eda1dd25331c9ce1d5b430266f7e
install-dist:
name: Build
diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml
index 83fef67fc..191a4bd7f 100644
--- a/.github/workflows/deployment.yml
+++ b/.github/workflows/deployment.yml
@@ -24,7 +24,7 @@ jobs:
- name: Check if main repo
id: is_main_repo
- uses: openremote/openremote/.github/actions/check-if-main-repo@fa6f52032b1dea3d4ad080cc6436a3ef3843b0be
+ uses: openremote/openremote/.github/actions/check-if-main-repo@5beec5454f28eda1dd25331c9ce1d5b430266f7e
- name: Checkout main repo
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
diff --git a/.github/workflows/install-dist.yml b/.github/workflows/install-dist.yml
index 61e88451f..9d5fbddd6 100644
--- a/.github/workflows/install-dist.yml
+++ b/.github/workflows/install-dist.yml
@@ -32,7 +32,7 @@ jobs:
- name: Check if main repo
id: is_main_repo
- uses: openremote/openremote/.github/actions/check-if-main-repo@fa6f52032b1dea3d4ad080cc6436a3ef3843b0be
+ uses: openremote/openremote/.github/actions/check-if-main-repo@5beec5454f28eda1dd25331c9ce1d5b430266f7e
- name: Set up JDK 21 and Gradle cache
uses: actions/setup-java@03ad4de0992f5dab5e18fcb136590ce7c4a0ac95 # v5.6.0
diff --git a/.github/workflows/staging.yml b/.github/workflows/staging.yml
index 04bcc76cc..6842461e4 100644
--- a/.github/workflows/staging.yml
+++ b/.github/workflows/staging.yml
@@ -65,7 +65,7 @@ jobs:
- name: Check if main repo
id: is_main_repo
- uses: openremote/openremote/.github/actions/check-if-main-repo@fa6f52032b1dea3d4ad080cc6436a3ef3843b0be
+ uses: openremote/openremote/.github/actions/check-if-main-repo@5beec5454f28eda1dd25331c9ce1d5b430266f7e
- name: Process ci_cd.json file
id: ci-cd-output
diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml
index f9061bfce..6623c40e2 100644
--- a/.github/workflows/unit-tests.yml
+++ b/.github/workflows/unit-tests.yml
@@ -24,7 +24,7 @@ jobs:
- name: Check if main repo
id: is_main_repo
- uses: openremote/openremote/.github/actions/check-if-main-repo@fa6f52032b1dea3d4ad080cc6436a3ef3843b0be
+ uses: openremote/openremote/.github/actions/check-if-main-repo@5beec5454f28eda1dd25331c9ce1d5b430266f7e
- name: Run unit tests
timeout-minutes: 20