Skip to content

Commit

Permalink
fix release script
Browse files Browse the repository at this point in the history
  • Loading branch information
vpaturet committed Oct 14, 2024
1 parent e82b11e commit 3ce0b4d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 3 additions & 3 deletions .circleci/release
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""
Expand All @@ -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() {
Expand Down
6 changes: 4 additions & 2 deletions application/src/main/java/EnturUpdatePomVersion.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public class EnturUpdatePomVersion {
private final List<String> pomFile = new ArrayList<>();
private String mainVersion;
private int versionNumber = 0;
private String newVersion;

public static void main(String[] args) {
try {
Expand Down Expand Up @@ -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*<version>)(\\d+.\\d+.\\d+)" +
VERSION_SEP +
Expand All @@ -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) {
Expand Down

0 comments on commit 3ce0b4d

Please sign in to comment.