Skip to content

Commit 286e021

Browse files
committed
fix: clean-up after signature
1 parent 33b1c2e commit 286e021

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

src/main/java/org/apache/commons/release/plugin/mojos/BuildAttestationMojo.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -501,8 +501,14 @@ private void signAndWriteStatement(final Statement statement, final Path outputP
501501
throw new MojoExecutionException("Failed to serialize attestation statement", e);
502502
}
503503
final AbstractGpgSigner signer = getSigner();
504-
final Path paeFile = DsseUtils.writePaeFile(statementBytes, outputPath);
505-
final byte[] sigBytes = DsseUtils.signFile(signer, paeFile);
504+
final byte[] sigBytes;
505+
try {
506+
final Path paeFile = DsseUtils.writePaeFile(statementBytes, outputPath);
507+
sigBytes = DsseUtils.signFile(signer, paeFile);
508+
Files.deleteIfExists(paeFile);
509+
} catch (final IOException e) {
510+
throw new MojoExecutionException("Failed to sign attestation statement", e);
511+
}
506512

507513
final Signature sig = new Signature()
508514
.setKeyid(DsseUtils.getKeyId(sigBytes))

0 commit comments

Comments
 (0)