From a27e2968c1240edc2a90dfc7bb447ad9a3195bea Mon Sep 17 00:00:00 2001 From: Li Zhineng Date: Mon, 25 Aug 2025 15:21:25 +0800 Subject: [PATCH] clean up after publishing --- publish/publish.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/publish/publish.php b/publish/publish.php index a60cbdf..3b237c8 100644 --- a/publish/publish.php +++ b/publish/publish.php @@ -140,6 +140,18 @@ function fileUpload(OssClient $client, string $bucket, string $object, string $f ]); } +function fileDelete(OssClient $client, string $bucket, string $object): void +{ + try { + $client->deleteObject([ + 'bucket' => $bucket, + 'key' => $object, + ]); + } catch (Throwable) { + // Ignore any error + } +} + function fileChecksum(string $filename): string { $contents = file_get_contents($filename); @@ -239,6 +251,9 @@ function getRuntimeFromLayerName(string $layerName): string step("Ensure layer is public in {$region}"); layerEnsureIsPublic($fc, $variant); + + step('Clean up the uploaded package after publishing'); + fileDelete($oss, $bucketName, $objectName); } step('Publish is done');