From 68bf26d0f4ab33f5394d26f425e53817f3464ac8 Mon Sep 17 00:00:00 2001 From: Roman Kelesidis Date: Sun, 2 Mar 2025 23:52:43 +0700 Subject: [PATCH] misc: Created cleanup script (for releases preparation) (#1833) * misc: Created cleanup script (for releases preparation) * Update _cleanup.php * Update _cleanup.php * Update _cleanup.php --- .github/workflows/cd.yml | 5 ++- _cleanup.php | 77 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 _cleanup.php diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index c9b384ca5..19301d0e6 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -46,11 +46,14 @@ jobs: - name: Install Composer dependencies run: composer install --no-progress --prefer-dist --optimize-autoloader + - name: Cleanup + run: php _cleanup.php && rm _cleanup.php + - name: Create archive id: create-zip run: | ZIP_NAME="torrentpier-v${{ env.RELEASE_VERSION }}.zip" - zip -r "$ZIP_NAME" . -x ".git/*" ".github/*" + zip -r "$ZIP_NAME" . -x ".git/*" echo "ZIP_NAME=$ZIP_NAME" >> $GITHUB_OUTPUT - name: Publish to GitHub diff --git a/_cleanup.php b/_cleanup.php new file mode 100644 index 000000000..c9d0da4e6 --- /dev/null +++ b/_cleanup.php @@ -0,0 +1,77 @@ +isDir()) { + removeDir($file->getPathname()); + } else { + removeFile($file->getPathname()); + } + } + + if (rmdir($dir)) { + echo "[INFO] Folder removed: $dir" . PHP_EOL; + } else { + echo "[ERROR] Folder cannot be removed: $dir" . PHP_EOL; + exit; + } +}