From 3ce0b4de8e7b21a874d5a66460a08925fb7e8fde Mon Sep 17 00:00:00 2001 From: Vincent Paturet Date: Mon, 14 Oct 2024 16:03:16 +0200 Subject: [PATCH] fix release script --- .circleci/release | 6 +++--- application/src/main/java/EnturUpdatePomVersion.java | 6 ++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.circleci/release b/.circleci/release index 3f83e4df7b1..a1bca4677be 100755 --- a/.circleci/release +++ b/.circleci/release @@ -34,14 +34,14 @@ function listAllTags() { ## List all Entur tags to allow the UpdatePomVersion java program find the next version number echo "" echo "Dump all entur tags to ${TAGS_FILE}" - mkdir target + mkdir -p target git tag -l | grep entur > ${TAGS_FILE} } function setPomVersion() { echo "" echo "Update pom.xml with new version" - javac -d ${APPLICATION_MODULE}/target/classes src/main/java/EnturUpdatePomVersion.java + javac -d ${APPLICATION_MODULE}/target/classes ${APPLICATION_MODULE}/src/main/java/EnturUpdatePomVersion.java VERSION="`java -cp ${APPLICATION_MODULE}/target/classes EnturUpdatePomVersion ${TAGS_FILE}`" echo "" @@ -55,7 +55,7 @@ function setPomVersion() { ## Add [ci skip] here before moving this to the CI server echo "" echo "Add and commit pom.xml" - git commit -m "Version ${VERSION}" **/pom.xml + git commit -m "Version ${VERSION}" pom.xml application/pom.xml } function mergeInOldReleaseWithNoChanges() { diff --git a/application/src/main/java/EnturUpdatePomVersion.java b/application/src/main/java/EnturUpdatePomVersion.java index 424b71f0ff2..cca6cd4925d 100644 --- a/application/src/main/java/EnturUpdatePomVersion.java +++ b/application/src/main/java/EnturUpdatePomVersion.java @@ -20,6 +20,7 @@ public class EnturUpdatePomVersion { private final List pomFile = new ArrayList<>(); private String mainVersion; private int versionNumber = 0; + private String newVersion; public static void main(String[] args) { try { @@ -51,9 +52,11 @@ private void run() throws IOException { readAndReplaceVersion(pom); replacePomFile(pom); } + System.out.println(newVersion); } public void readAndReplaceVersion(Path pom) throws IOException { + pomFile.clear(); var pattern = Pattern.compile( "(\\s*)(\\d+.\\d+.\\d+)" + VERSION_SEP + @@ -70,9 +73,8 @@ public void readAndReplaceVersion(Path pom) throws IOException { var m = pattern.matcher(line); if (m.matches()) { mainVersion = m.group(2); - String newVersion = mainVersion + VERSION_SEP + ENTUR_PREFIX + resolveVersionNumber(); + newVersion = mainVersion + VERSION_SEP + ENTUR_PREFIX + resolveVersionNumber(); line = m.group(1) + newVersion + m.group(4); - System.out.println(newVersion); found = true; } if (++i == 25) {