Introduce verify-local command to verify the local build setup required to release Spring Data.

Closes #50
This commit is contained in:
Mark Paluch
2023-06-15 16:36:29 +02:00
parent f18b09c238
commit 1cd87fb062
5 changed files with 45 additions and 5 deletions

View File

@@ -114,12 +114,11 @@ Add an `application-local.properties` to the project root and add the following
* `gpg.keyname` - The GPG key name.
* `gpg.passphrase` - The password of your GPG key.
* `gpg.executable` - Path to your GPG executable, typically `/usr/local/MacGPG2/bin/gpg2`
or `/usr/local/bin/gpg`.
* `project-service.key` - Project Service authentication token. Must be a valid GitHub token. Can be the same
as `git.password` when using a GitHub token as password.
or `/usr/local/bin/gpg`.
* `project-service.key` - Project Service authentication token.Must be a valid GitHub token.Can be the same
as `git.password` when using a GitHub token as password.
After that, run the `verify` command (`$ verify`) to verify your settings (authentication,
correct Maven, Java, and GPG setup).
After that, run the `verify-local` command (`$ verify-local`) to verify your local settings (authentication, correct Maven, Java, and GPG setup).
See `application-local.template` for details.

View File

@@ -366,6 +366,17 @@ public class BuildOperations {
buildSystem.withJavaVersion(executor.detectJavaVersion(project)).verify();
}
/**
* Verifies Maven staging authentication.
*/
public void verifyStagingAuthentication() {
Project project = Projects.BUILD;
BuildSystem buildSystem = buildSystems.getRequiredPluginFor(project);
buildSystem.withJavaVersion(executor.detectJavaVersion(project)).verifyStagingAuthentication();
}
/**
* Selects the build system for the module contained in the given {@link ModuleIteration} and executes the given
* function with it.

View File

@@ -116,6 +116,11 @@ interface BuildSystem extends Plugin<Project> {
*/
void verify();
/**
* Verify general functionality and correctness of the build setup.
*/
void verifyStagingAuthentication();
/**
* Prepare the build system with a Java version.
*

View File

@@ -550,6 +550,12 @@ class MavenBuildSystem implements BuildSystem {
.andIf(gpg.hasSecretKeyring(), () -> arg("gpg.secretKeyring").withValue(gpg.getSecretKeyring()));
mvn.execute(BUILD, arguments);
}
@Override
public void verifyStagingAuthentication() {
logger.log(BUILD, "Verifying Maven Staging Authentication…");
mvn.execute(BUILD, CommandLine.of(goal("nexus-staging:rc-list-profiles"), //
profile("central")));

View File

@@ -60,6 +60,7 @@ class VerifyCommands extends TimedCommand {
if (ObjectUtils.isEmpty(module) || "build".equals(module)) {
// Maven interaction
build.verify();
build.verifyStagingAuthentication();
}
if (ObjectUtils.isEmpty(module) || "deployment".equals(module)) {
@@ -80,4 +81,22 @@ class VerifyCommands extends TimedCommand {
logger.log("Verify", "All settings are verified. You can ship a release now.");
}
@CliCommand("verify-local")
public void verifyLocalReleaseTools() {
// Git checkout build
git.verify();
// Maven interaction
build.verify();
// GitHub verification
github.verifyAuthentication();
// Projects Service Verification
projectService.verifyAuthentication();
logger.log("Verify", "All local settings are verified. You can ship a release now.");
}
}