1
0
Fork 0
mirror of https://github.com/docker/build-push-action.git synced 2025-05-06 21:49:33 +02:00

generate build summary

Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax 2024-05-02 13:49:01 +02:00
parent e51051ad0b
commit d880b1964b
No known key found for this signature in database
GPG key ID: ADE44D8C9D44FBE4
3 changed files with 34 additions and 2 deletions

View file

@ -23,6 +23,7 @@ actionsToolkit.run(
const startedTime = new Date();
const inputs: context.Inputs = await context.getInputs();
core.debug(`inputs: ${JSON.stringify(inputs)}`);
stateHelper.setInputs(inputs);
const toolkit = new Toolkit();
@ -139,18 +140,23 @@ actionsToolkit.run(
// post
async () => {
if (stateHelper.buildRef.length > 0) {
await core.group(`Exporting build record`, async () => {
await core.group(`Generating build summary`, async () => {
try {
const buildxHistory = new BuildxHistory();
const exportRes = await buildxHistory.export({
refs: [stateHelper.buildRef]
});
core.info(`Build record exported to ${exportRes.dockerbuildFilename} (${Util.formatFileSize(exportRes.dockerbuildSize)})`);
await GitHub.uploadArtifact({
const uploadRes = await GitHub.uploadArtifact({
filename: exportRes.dockerbuildFilename,
mimeType: 'application/gzip',
retentionDays: 90
});
await GitHub.writeBuildSummary({
exportRes: exportRes,
uploadRes: uploadRes,
inputs: stateHelper.inputs
});
} catch (e) {
core.warning(e.message);
}