Introduce changelog report.

Introduce a tool to collect and update the changelog.txt file. Ensure that updating this report is part of the pre-checks before doing a release.

Resolves #1295.
This commit is contained in:
Greg L. Turnquist
2022-11-21 09:30:50 -06:00
parent 593915cd93
commit cb189cf9ae
6 changed files with 1175 additions and 0 deletions

View File

@@ -36,6 +36,7 @@ Before you make a release, follow this checklist:
* Are you using the latest milestone/release candidate/release of Spring Security? If not, upgrade. (Don't forget `spring-buildsnapshot` profile.)
* Are you setup with the right version of Java? If not switch. (Java 17 for 4.0+, Java 8 for everything else.)
* Is it time to switch from milestone to release candidate? Or from release candidate to release?
* Have you closed this release's Github issue milestone, run `ChangeLogCreator` and updated `changelog.txt`?
NOTE: The _actual_ building and releasing is done on CI inside a Docker container, ensuring little risk between versions of Java.
But part of the release process requires a local check, which DOES depend upon your environment.

View File

@@ -7,6 +7,19 @@
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<!--
Adds readme and other textfiles to the root of the distribution archive.
-->
<directory>src/dist</directory>
<includes>
<include>changelog.txt</include>
<include>license.txt</include>
<include>notice.txt</include>
<include>readme.txt</include>
</includes>
<outputDirectory />
</fileSet>
<fileSet>
<!--
Adds reference manual (html) to the distribution archive

View File

@@ -113,6 +113,7 @@
<slf4j.version>2.0.3</slf4j.version>
<smack.version>4.3.5</smack.version>
<spring.version>6.0.0</spring.version>
<spring-hateos.version>2.0.0</spring-hateos.version>
<spring-security.version>6.0.0-RC1</spring-security.version>
<sun-mail.version>2.0.1</sun-mail.version>
<stax.version>2.0.1</stax.version>
@@ -553,6 +554,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<id>copy-asciidoc-resources</id>

View File

@@ -205,6 +205,18 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.hateoas</groupId>
<artifactId>spring-hateoas</artifactId>
<version>${spring-hateos.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webflux</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<profiles>

View File

@@ -0,0 +1,107 @@
/*
* Copyright 2005-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.ws.support;
import net.minidev.json.JSONArray;
import java.time.Duration;
import java.time.LocalDate;
import java.util.Iterator;
import java.util.List;
import org.springframework.hateoas.IanaLinkRelations;
import org.springframework.hateoas.Links;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.web.reactive.function.client.WebClient;
import com.jayway.jsonpath.JsonPath;
/**
* Little helper to build a changelog from the tickets of a particular milestone.
*
* @author Oliver Gierke
* @author Greg Turnquist
*/
class ChangelogCreator {
private static final int MILESTONE_ID = 91;
private static final String URI_TEMPLATE = "https://api.github.com/repos/spring-projects/spring-ws/issues?milestone={id}&state=closed";
public static void main(String... args) {
/*
* If you run into github rate limiting issues, you can always use a Github Personal Token by adding
* {@code .header(HttpHeaders.AUTHORIZATION, "token your-github-token")} to the webClient call.
*/
WebClient webClient = WebClient.create();
try {
HttpEntity<String> response = webClient //
.get().uri(URI_TEMPLATE, MILESTONE_ID) //
// .header(HttpHeaders.AUTHORIZATION, "token <plugin in a personal token and uncomment>") //
.exchangeToMono(clientResponse -> clientResponse.toEntity(String.class)) //
.block(Duration.ofSeconds(10));
boolean keepChecking = true;
boolean printHeader = true;
while (keepChecking) {
readPage(response.getBody(), printHeader);
printHeader = false;
List<String> linksInHeader = response.getHeaders().get(HttpHeaders.LINK);
Links links = linksInHeader == null ? Links.NONE : Links.parse(linksInHeader.get(0));
if (links.getLink(IanaLinkRelations.NEXT).isPresent()) {
response = webClient //
.get().uri(links.getRequiredLink(IanaLinkRelations.NEXT).expand().getHref()) //
.exchangeToMono(clientResponse -> clientResponse.toEntity(String.class)) //
.block(Duration.ofSeconds(10));
} else {
keepChecking = false;
}
}
} catch (Exception e) {
System.out.println("Couldn't retrieve MILESTONE " + MILESTONE_ID);
}
}
private static void readPage(String content, boolean header) {
JsonPath titlePath = JsonPath.compile("$[*].title");
JsonPath idPath = JsonPath.compile("$[*].number");
JSONArray titles = titlePath.read(content);
Iterator<Object> ids = ((JSONArray) idPath.read(content)).iterator();
if (header) {
System.out.println(
"Changes in version " + JsonPath.read(content, "$[0].milestone.title") + " (" + LocalDate.now() + ")");
System.out.println("----------------------------------------");
}
for (Object title : titles) {
String format = String.format("- #%s - %s", ids.next(), title.toString().replaceAll("`", ""));
System.out.println(format.endsWith(".") ? format : format.concat("."));
}
}
}

1040
src/dist/changelog.txt vendored Normal file

File diff suppressed because it is too large Load Diff