This is an automated email from the ASF dual-hosted git repository. rec pushed a commit to branch refactoring/59-Replace-maven-changes-plugin-with-call-to-GH-API-to-generate-release-notes in repository https://gitbox.apache.org/repos/asf/uima-parent-pom.git
commit ae5b3bb58eb440d8fee22d1d75d0bfaa64545728 Author: Richard Eckart de Castilho <[email protected]> AuthorDate: Fri Aug 11 16:54:05 2023 +0200 Issue #59: Replace maven-changes-plugin with call to GH API to generate release notes - Added new profile that uses the gh CLI tool to generate release notes and writes them to issuesFixed/github-report.md --- ...es-report => marker-file-enabling-release-notes | 0 pom.xml | 95 ++++++++++++++++++++++ 2 files changed, 95 insertions(+) diff --git a/marker-file-enabling-changes-report b/marker-file-enabling-release-notes similarity index 100% rename from marker-file-enabling-changes-report rename to marker-file-enabling-release-notes diff --git a/pom.xml b/pom.xml index c323433..9a65ae2 100644 --- a/pom.xml +++ b/pom.xml @@ -91,6 +91,10 @@ </ciManagement> <properties> + <github-repository>uima-parent-pom</github-repository> + <git-branch>main</git-branch> + <previous-release-version>16</previous-release-version> + <!-- *********************************************************************************************************** --> <!-- U G H change manually for release (to remove -SNAPSHOT * --> <!-- *********************************************************************************************************** --> @@ -520,6 +524,20 @@ <artifactId>maven-enforcer-plugin</artifactId> <version>3.3.0</version> </plugin> + + <plugin> + <groupId>org.codehaus.gmaven</groupId> + <artifactId>groovy-maven-plugin</artifactId> + <version>2.1.1</version> + <dependencies> + <dependency> + <groupId>org.codehaus.groovy</groupId> + <artifactId>groovy-all</artifactId> + <version>3.0.18</version> + <type>pom</type> + </dependency> + </dependencies> + </plugin> </plugins> </pluginManagement> @@ -976,6 +994,83 @@ </build> </profile> + <!-- *********************************************** --> + <!-- * Generate release notes * --> + <!-- *********************************************** --> + <profile> + <id>generate-release-notes</id> + <activation> + <file> + <exists>marker-file-enabling-release-notes</exists> + </file> + </activation> + <build> + <plugins> + <plugin> + <artifactId>maven-antrun-plugin</artifactId> + <executions> + <execution> + <id>gh-generate-release-notes</id> + <phase>prepare-package</phase> + <goals> + <goal>run</goal> + </goals> + <configuration> + <exportAntProperties>true</exportAntProperties> + <target> + <echo level="info">Generating release notes using GitHub API via the gh CLI tool</echo> + <echo level="info">Repository : ${github-repository}</echo> + <echo level="info">New tag : ${project.artifactId}-${project.version}</echo> + <echo level="info">Old tag : rel/${project.artifactId}-${previous-release-version}</echo> + <echo level="info">Branch : ${git-branch}</echo> + <mkdir dir="issuesFixed"/> + <exec executable="gh" failonerror="true" outputproperty="gh-release-notes"> + <arg value="api" /> + <arg value="--method" /> + <arg value="POST" /> + <arg value="-H" /> + <arg value="Accept: application/vnd.github+json" /> + <arg value="-H" /> + <arg value="X-GitHub-Api-Version: 2022-11-28" /> + <arg value="/repos/apache/${github-repository}/releases/generate-notes" /> + <arg value="-f" /> + <arg value="tag_name=${project.artifactId}-${project.version}" /> + <arg value="-f" /> + <arg value="target_commitish=${git-branch}" /> + <arg value="-f" /> + <arg value="previous_tag_name=rel/${project.artifactId}-${previous-release-version}" /> + </exec> + </target> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.codehaus.gmaven</groupId> + <artifactId>groovy-maven-plugin</artifactId> + <executions> + <execution> + <!-- Load postNoticeText from NOTICE file --> + <id>gh-store-release-notes</id> + <phase>prepare-package</phase> + <goals> + <goal>execute</goal> + </goals> + <configuration> + <source><![CDATA[ + import groovy.json.JsonSlurper + def jsonSlurper = new JsonSlurper() + def json = jsonSlurper.parseText(project.properties['gh-release-notes']) + new File('issuesFixed/github-report.md').withWriter("UTF-8") { out -> out.write(json.body) } + ]]></source> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> + </profile> + <!-- *********************************************** --> <!-- * Generate changes report * --> <!-- *********************************************** -->
