diff --git a/readme.adoc b/readme.adoc index 9b743f7..bd2f687 100644 --- a/readme.adoc +++ b/readme.adoc @@ -55,10 +55,8 @@ A job should have started. Click on the active job, and then click on *Open Blue |=== -* For a Maven central release, go to https://s01.oss.sonatype.org/ and login. -** After logging in, you will find a closed Spring Data Release repository. -** Click the repository and then choose "Release". -* For an artifactory release, the release will already have been staged and promoted, so there is nothing more to do. +* For a Maven central release, if the smoke test has passed, the repository will already have been released, so there is nothing more to do. +* For an Artifactory release, if the smoke test has passed, the release will already have been staged and promoted, so there is nothing more to do. * 🚥 Continue with `Post-release tasks` [[post-release]] @@ -98,7 +96,6 @@ Congratulations 🥳 You completed the release ❤️. ===== Infrastructure requirements * Ensure you have the credentials for `buildmaster` accounts on https://repo.spring.io. -* Ensure you have the credentials for https://oss.sonatype.org (to deploy and promote GA and service releases, need deployment permissions for `org.springframework.data`) in `settings.xml` for server with id `sonatype`. Both are available in the Spring/Pivotal Last Pass repository. @@ -137,7 +134,7 @@ See `application-local.template` for details. | |`$ release prepare $trainIteration` | |`$ release conclude $trainIteration` 2+| *Build the release* -|Build the artifacts from tag and push them to the appropriate maven repository |`$ release build $trainIteration` +|Build the artifacts from tag and push them to the appropriate maven repository. Also runs smoke tests, does Sonatype "release" if applicable, and does Artifactory "promote" if applicable. |`$ release build $trainIteration` |Distribute documentation and static resources from tag |`$ release distribute $trainIteration` |Push the created commits to GitHub |`$ github push $trainIteration` |Push new maintenance branches if the release version was a GA release (`X.Y.0` version) |`$ git push $trainIteration.next` diff --git a/src/main/java/org/springframework/data/release/build/BuildOperations.java b/src/main/java/org/springframework/data/release/build/BuildOperations.java index 519785c..141442a 100644 --- a/src/main/java/org/springframework/data/release/build/BuildOperations.java +++ b/src/main/java/org/springframework/data/release/build/BuildOperations.java @@ -45,6 +45,7 @@ import org.springframework.util.Assert; /** * @author Oliver Gierke * @author Mark Paluch + * @author Greg Turnquist */ @Component @RequiredArgsConstructor @@ -162,6 +163,20 @@ public class BuildOperations { }); } + /** + * Releases a repository of staged artifacts for this {@link ModuleIteration}. + * + * @param iteration + * @param stagingRepository + */ + public void release(ModuleIteration iteration, StagingRepository stagingRepository) { + + doWithBuildSystem(iteration, (buildSystem, moduleIteration) -> { + buildSystem.release(stagingRepository); + return null; + }); + } + public void buildDocumentation(TrainIteration iteration) { executor.doWithBuildSystemOrdered(Streamable.of(iteration.getModulesExcept(BOM, COMMONS, BUILD)), @@ -202,6 +217,10 @@ public class BuildOperations { logger.log(iteration, "Release: %s", summary); + if (iteration.getIteration().isPublic() && stagingRepository.isPresent()) { + release(module, stagingRepository); + } + return summary.getExecutions().stream().map(BuildExecutor.ExecutionResult::getResult).collect(Collectors.toList()); } diff --git a/src/main/java/org/springframework/data/release/build/BuildSystem.java b/src/main/java/org/springframework/data/release/build/BuildSystem.java index a5cd5e1..40b93aa 100644 --- a/src/main/java/org/springframework/data/release/build/BuildSystem.java +++ b/src/main/java/org/springframework/data/release/build/BuildSystem.java @@ -30,6 +30,7 @@ import org.springframework.plugin.core.Plugin; * * @author Oliver Gierke * @author Mark Paluch + * @author Greg Turnquist */ interface BuildSystem extends Plugin { @@ -68,6 +69,11 @@ interface BuildSystem extends Plugin { */ void close(StagingRepository stagingRepository); + /** + * Release a remote repository of staged artifacts. + */ + void release(StagingRepository stagingRepository); + M triggerBuild(M module); M triggerDocumentationBuild(M module); diff --git a/src/main/java/org/springframework/data/release/build/MavenBuildSystem.java b/src/main/java/org/springframework/data/release/build/MavenBuildSystem.java index f0075f8..ce7cf8a 100644 --- a/src/main/java/org/springframework/data/release/build/MavenBuildSystem.java +++ b/src/main/java/org/springframework/data/release/build/MavenBuildSystem.java @@ -387,6 +387,23 @@ class MavenBuildSystem implements BuildSystem { logger.log(iteration, "✅ Smoke tests passed. Do not smoke 🚭. It's unhealthy."); } + /** + * Perform a {@literal nexus-staging:rc-release}. + */ + @Override + public void release(StagingRepository stagingRepository) { + + Assert.notNull(stagingRepository, "StagingRepository must not be null"); + Assert.isTrue(stagingRepository.isPresent(), "StagingRepository must be present"); + + CommandLine arguments = CommandLine.of(goal("nexus-staging:rc-release"), // + profile("central"), // + arg("stagingRepositoryId").withValue(stagingRepository.getId())) + .andIf(!ObjectUtils.isEmpty(properties.getSettingsXml()), () -> settingsXml(properties.getSettingsXml())); + + mvn.execute(BUILD, arguments); + } + @Override public M triggerDocumentationBuild(M module) { diff --git a/src/main/java/org/springframework/data/release/cli/ReleaseCommands.java b/src/main/java/org/springframework/data/release/cli/ReleaseCommands.java index 3cbb1f5..b3e98f2 100644 --- a/src/main/java/org/springframework/data/release/cli/ReleaseCommands.java +++ b/src/main/java/org/springframework/data/release/cli/ReleaseCommands.java @@ -46,6 +46,7 @@ import org.springframework.util.Assert; /** * @author Oliver Gierke + * @author Greg Turnquist */ @CliComponent @RequiredArgsConstructor @@ -149,6 +150,15 @@ class ReleaseCommands extends TimedCommand { } } + @CliCommand(value = "release repository") + public void repositoryRelease(@CliOption(key = "", mandatory = true) TrainIteration iteration, + @CliOption(key = "stagingRepositoryId", mandatory = true) String stagingRepositoryId) { + + if (iteration.getIteration().isPublic()) { + build.release(iteration.getModule(Projects.BUILD), StagingRepository.of(stagingRepositoryId)); + } + } + @CliCommand(value = "release build") public void buildRelease(@CliOption(key = "", mandatory = true) TrainIteration iteration, // @CliOption(key = "project", mandatory = false) String projectName) {