You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by pp...@apache.org on 2021/08/26 09:41:26 UTC
[camel-quarkus] 01/02: Set the version in docs/antora.yml when
tagging a release #2852
This is an automated email from the ASF dual-hosted git repository.
ppalaga pushed a commit to branch i2852
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
commit 1ee366293cb7b783a994553931cad246e68a183c
Author: Peter Palaga <pp...@redhat.com>
AuthorDate: Thu Aug 26 10:38:43 2021 +0200
Set the version in docs/antora.yml when tagging a release #2852
---
pom.xml | 48 ++++++++++++++++++++++++++---
tooling/scripts/update-antora-config.groovy | 13 ++++++--
2 files changed, 55 insertions(+), 6 deletions(-)
diff --git a/pom.xml b/pom.xml
index 35eace7..aefcfa7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -164,6 +164,7 @@
<maven-source-plugin.version>3.1.0</maven-source-plugin.version>
<maven-release-plugin.version>2.5.3</maven-release-plugin.version>
<maven-resources-plugin.version>3.1.0</maven-resources-plugin.version>
+ <maven-scm-plugin.version>1.11.3</maven-scm-plugin.version>
<maven-shade-plugin.version>3.2.4</maven-shade-plugin.version>
<!-- NOTE: We pin to this version due to https://github.com/apache/camel-quarkus/issues/723 -->
<maven-surefire-plugin.version>2.22.2</maven-surefire-plugin.version>
@@ -320,14 +321,13 @@
<version>${maven-release-plugin.version}</version>
<configuration>
<!-- release:prepare config -->
- <preparationGoals>clean package</preparationGoals>
+ <preparationGoals>clean package -Pcommit-release-changes "-Dcq.commit.message.prefix=[maven-release-plugin] Prepare release" -DskipTests -Denforcer.skip -Dquarkus.build.skip -Dformatter.skip -Dimpsort.skip</preparationGoals>
+ <completionGoals>process-classes -Pcommit-release-changes "-Dcq.commit.message.prefix=[maven-release-plugin] Set next development version" -DskipTests -Denforcer.skip -Dquarkus.build.skip -Dformatter.skip -Dimpsort.skip</completionGoals>
<waitBeforeTagging>10</waitBeforeTagging>
<!-- release:perform config -->
<useReleaseProfile>true</useReleaseProfile>
<releaseProfiles>apache-release</releaseProfiles>
<goals>deploy</goals>
- <!-- Both release:prepare and release:perform config -->
- <arguments>-DskipTests -Denforcer.skip -Dquarkus.build.skip -Dformatter.skip -Dimpsort.skip</arguments>
</configuration>
</plugin>
@@ -339,6 +339,12 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-scm-plugin</artifactId>
+ <version>${maven-scm-plugin.version}</version>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>${maven-shade-plugin.version}</version>
</plugin>
@@ -953,7 +959,41 @@
</plugins>
</build>
</profile>
-
+ <profile>
+ <id>commit-release-changes</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-scm-plugin</artifactId>
+ <inherited>false</inherited>
+ <executions>
+ <execution>
+ <id>add-changed-files-to-scm</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add</goal>
+ </goals>
+ <configuration>
+ <basedir>${basedir}</basedir>
+ <includes>docs/antora.yml</includes>
+ </configuration>
+ </execution>
+ <execution>
+ <id>commit-changed-files-to-scm</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>checkin</goal>
+ </goals>
+ <configuration>
+ <message>${cq.commit.message.prefix} ${project.version}</message>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
<profile>
<id>deploy</id>
<activation>
diff --git a/tooling/scripts/update-antora-config.groovy b/tooling/scripts/update-antora-config.groovy
index 9533d9c..78e9b02 100644
--- a/tooling/scripts/update-antora-config.groovy
+++ b/tooling/scripts/update-antora-config.groovy
@@ -42,7 +42,8 @@ if (!missingFiles.isEmpty()) {
throw new IllegalStateException("Files expected to exist: " + missingFiles)
}
-
+def activeProfiles = project.activeProfiles
+final boolean isApacheReleaseActive = activeProfiles.stream().anyMatch{ p -> p.id.equals('apache-release')}
final Pattern replacementPattern = ~'([\\-\\:]) *([^ ]+) *# * replace \\$\\{([^}]+)\\}'
replaceInFiles.each { path ->
@@ -57,7 +58,15 @@ replaceInFiles.each { path ->
m.appendReplacement(newContent, '$1 ' + Matcher.quoteReplacement(newValue) + ' # replace ' + Matcher.quoteReplacement('${' + property + '}'))
}
m.appendTail(newContent)
- final String newContentString = newContent.toString()
+ String newContentString = newContent.toString()
+
+ if (path.getFileName().toString().equals('antora.yml')) {
+ final String versionReplacement = 'version: ' + (isApacheReleaseActive ? project.version : 'latest')
+ println ' - seting '+ versionReplacement
+ final Pattern versionPattern = ~'version: [^\\s]+'
+ newContentString = versionPattern.matcher(newContentString).replaceFirst(versionReplacement)
+ }
+
if (!newContentString.equals(content)) {
println 'Updated ' + path
Files.write(path, newContentString.getBytes('UTF-8'))