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; + } +}