From d969889dc1827e2303fb87c6ff5d4183b1cbe312 Mon Sep 17 00:00:00 2001 From: John Freeman Date: Sun, 17 Nov 2024 14:05:28 +0000 Subject: [PATCH] Enabled Maven CI Friendly Versions (#650) Avoid the need to run the release plugin locally. --- .github/workflows/maven-build.yml | 1 + .github/workflows/maven-deploy.yml | 5 +++-- .github/workflows/release.yml | 7 +++++-- pom.xml | 2 +- src/it/check/postbuild.groovy | 2 +- 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/.github/workflows/maven-build.yml b/.github/workflows/maven-build.yml index 1976f299..e2f97a7d 100644 --- a/.github/workflows/maven-build.yml +++ b/.github/workflows/maven-build.yml @@ -69,6 +69,7 @@ jobs: - name: Build with Maven run: | "$M2_HOME/bin/mvn" install \ + "-Drevision=${GIT_TAG:-development-SNAPSHOT}" \ --batch-mode \ --show-version \ -Dinvoker.streamLogs=true \ diff --git a/.github/workflows/maven-deploy.yml b/.github/workflows/maven-deploy.yml index 9cb367e3..4430cbde 100644 --- a/.github/workflows/maven-deploy.yml +++ b/.github/workflows/maven-deploy.yml @@ -10,10 +10,10 @@ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: -# +# # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. -# +# # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -57,6 +57,7 @@ jobs: run: | ./mvnw deploy \ -P publish-artifacts,sign-artifacts,ossrh-deploy \ + "-Drevision=${GIT_TAG:-development-SNAPSHOT}" \ -DskipTests \ -Dinvoker.skip=true \ --batch-mode \ diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6fd3e971..f94b9685 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,10 +10,10 @@ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: -# +# # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. -# +# # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -69,6 +69,7 @@ jobs: - name: Build Maven site run: | ./mvnw site \ + "-Drevision=${GIT_TAG:-development-SNAPSHOT}" \ -DskipTests \ -Dinvoker.skip=true \ --batch-mode \ @@ -79,6 +80,7 @@ jobs: - name: Stage Maven site run: | ./mvnw site:stage \ + "-Drevision=${GIT_TAG:-development-SNAPSHOT}" \ -DskipTests \ -Dinvoker.skip=true \ --batch-mode \ @@ -89,6 +91,7 @@ jobs: run: | ./mvnw scm-publish:publish-scm \ -P gh-pages \ + "-Drevision=${GIT_TAG:-development-SNAPSHOT}" \ -DskipTests \ -Dinvoker.skip=true \ --batch-mode \ diff --git a/pom.xml b/pom.xml index 1e917325..862091c4 100644 --- a/pom.xml +++ b/pom.xml @@ -36,7 +36,7 @@ com.github.gantsign.maven ktlint-maven-plugin - 3.3.1-SNAPSHOT + ${revision} maven-plugin diff --git a/src/it/check/postbuild.groovy b/src/it/check/postbuild.groovy index 34dbf7d4..752454a8 100644 --- a/src/it/check/postbuild.groovy +++ b/src/it/check/postbuild.groovy @@ -25,4 +25,4 @@ */ String buildLog = new File(basedir, 'build.log').text assert buildLog.contains('[ERROR] src/main/kotlin/example/Example.kt:29:39: Unnecessary semicolon') -assert buildLog =~ /\Q[ERROR] Failed to execute goal com.github.gantsign.maven:ktlint-maven-plugin:\E[0-9.]+(-SNAPSHOT)?\Q:check (check) on project test-project: Kotlin source failed ktlint check. -> [Help 1]\E/ +assert buildLog =~ /\Q[ERROR] Failed to execute goal com.github.gantsign.maven:ktlint-maven-plugin:\E[0-9a-z.]+(-SNAPSHOT)?\Q:check (check) on project test-project: Kotlin source failed ktlint check. -> [Help 1]\E/