Skip to content

Commit

Permalink
#16 - Added Maven Central distribution
Browse files Browse the repository at this point in the history
Introduced properties for GPG plugin and forward them to the execution of the release build. Public release versions now trigger the "central" profile being used which will enable the Nexus repository distribution.

Renamed GitCommands.checkout(…) to update(…). Made sure that project release build execution now also authenticates with Artifactory beforehand.
  • Loading branch information
odrotbohm committed Mar 31, 2016
1 parent cc257ac commit e62c76b
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 3 deletions.
7 changes: 7 additions & 0 deletions release-tools/application-local.template
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,11 @@ git.password=
maven.mavenHome=

# Deployment
deployment.repository-prefix=
deployment.password=
deployment.api-key=

# GPG
deployment.gpg.keyname=
deployment.gpg.password=
# deployment.gpg.executable=/usr/local/bin/gpg2
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.springframework.core.annotation.Order;
import org.springframework.data.release.deployment.DeploymentInformation;
import org.springframework.data.release.deployment.DeploymentProperties;
import org.springframework.data.release.deployment.DeploymentProperties.Gpg;
import org.springframework.data.release.io.Workspace;
import org.springframework.data.release.model.ArtifactVersion;
import org.springframework.data.release.model.ModuleIteration;
Expand Down Expand Up @@ -247,7 +248,7 @@ public DeploymentInformation deploy(ModuleIteration module) {
List<String> arguments = new ArrayList<>();
arguments.add("clean");
arguments.add("deploy");
arguments.add("-Pci,release");
arguments.add("-Pci,release".concat(module.getIteration().isPublic() ? ",central" : ""));

arguments.add("-DskipTests");

Expand All @@ -258,6 +259,15 @@ public DeploymentInformation deploy(ModuleIteration module) {
arguments.add("-Dartifactory.build-name=\"".concat(information.getBuildName()).concat("\""));
arguments.add("-Dartifactory.build-number=".concat(information.getBuildNumber()));

if (module.getIteration().isPublic()) {

Gpg gpg = properties.getGpg();

arguments.add("-Dgpg.executable=".concat(gpg.getExecutable()));
arguments.add("-Dgpg.keyname=".concat(gpg.getKeyname()));
arguments.add("-Dgpg.password=".concat(gpg.getPassword()));
}

mvn.execute(module.getProject(), arguments);

return information;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ public void buildRelease(@CliOption(key = "", mandatory = true) TrainIteration i

if (projectName != null) {

deployment.verifyAuthentication();

Project project = Projects.byName(projectName);
ModuleIteration module = iteration.getModule(project);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ public class DeploymentProperties {

private String repositoryPrefix = "";

private Gpg gpg;

public String getStagingRepository() {
return repositoryPrefix.concat(stagingRepository);
}
Expand Down Expand Up @@ -105,4 +107,9 @@ public URI getVerificationResource() {
return URI.create(uri.concat(VERIFICATION_RESOURCE));
}
}

@Data
public static class Gpg {
private String keyname, password, executable;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public void checkout(@CliOption(key = "", mandatory = true) TrainIteration itera
}

@CliCommand("git update")
public void checkout(@CliOption(key = { "", "train" }, mandatory = true) String trainName)
public void update(@CliOption(key = { "", "train" }, mandatory = true) String trainName)
throws Exception, InterruptedException {
git.update(ReleaseTrains.getTrainByName(trainName));
}
Expand Down
7 changes: 6 additions & 1 deletion release-tools/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,9 @@ maven.plugins.versions=org.codehaus.mojo:versions-maven-plugin:2.2
deployment.server.uri=https://repo.spring.io
deployment.staging-repository=libs-staging-local
deployment.username=buildmaster
#deployment.password <- local
#deployment.password <- local

# GPG setup
deployment.gpg.executable=/usr/local/bin/gpg2
# deployment.gpg.keyname
# deployment.gpg.password

0 comments on commit e62c76b

Please sign in to comment.