Search in sources :

Example 1 with BuildInfo

use of io.spring.concourse.releasescripts.artifactory.payload.BuildInfoResponse.BuildInfo in project spring-boot by spring-projects.

the class PublishToCentralCommand method run.

@Override
public void run(ApplicationArguments args) throws Exception {
    List<String> nonOptionArgs = args.getNonOptionArgs();
    Assert.state(nonOptionArgs.size() == 4, "Release type, build info location, or artifacts location not specified");
    String releaseType = nonOptionArgs.get(1);
    ReleaseType type = ReleaseType.from(releaseType);
    if (!ReleaseType.RELEASE.equals(type)) {
        return;
    }
    String buildInfoLocation = nonOptionArgs.get(2);
    logger.debug("Loading build-info from " + buildInfoLocation);
    byte[] content = Files.readAllBytes(new File(buildInfoLocation).toPath());
    BuildInfoResponse buildInfoResponse = this.objectMapper.readValue(content, BuildInfoResponse.class);
    BuildInfo buildInfo = buildInfoResponse.getBuildInfo();
    ReleaseInfo releaseInfo = ReleaseInfo.from(buildInfo);
    String artifactsLocation = nonOptionArgs.get(3);
    this.sonatype.publish(releaseInfo, new File(artifactsLocation).toPath());
}
Also used : ReleaseType(io.spring.concourse.releasescripts.ReleaseType) BuildInfo(io.spring.concourse.releasescripts.artifactory.payload.BuildInfoResponse.BuildInfo) ReleaseInfo(io.spring.concourse.releasescripts.ReleaseInfo) BuildInfoResponse(io.spring.concourse.releasescripts.artifactory.payload.BuildInfoResponse) File(java.io.File)

Aggregations

ReleaseInfo (io.spring.concourse.releasescripts.ReleaseInfo)1 ReleaseType (io.spring.concourse.releasescripts.ReleaseType)1 BuildInfoResponse (io.spring.concourse.releasescripts.artifactory.payload.BuildInfoResponse)1 BuildInfo (io.spring.concourse.releasescripts.artifactory.payload.BuildInfoResponse.BuildInfo)1 File (java.io.File)1