From cf035bcbd5e8d2630169c147a46e99d5a3957e89 Mon Sep 17 00:00:00 2001 From: Soner Sayakci Date: Fri, 14 Feb 2025 15:27:11 +0100 Subject: [PATCH] fix: update tar command for macOS compatibility and clean up workflow --- .github/workflows/php.yml | 2 -- src/Utils/TarBuilder.php | 9 ++++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 23c29bf..4273c5a 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -5,8 +5,6 @@ on: branches: - main pull_request: - branches: - - main permissions: contents: read diff --git a/src/Utils/TarBuilder.php b/src/Utils/TarBuilder.php index ba615e7..40c5e37 100644 --- a/src/Utils/TarBuilder.php +++ b/src/Utils/TarBuilder.php @@ -136,9 +136,16 @@ class TarBuilder private function runTarCommand(string $tarFilePath, string $sourceDir): void { + if (PHP_OS_FAMILY === 'Darwin') { + $additionalFlags = ' --disable-copyfile --no-xattrs'; + } else { + $additionalFlags = ''; + } + // without --disable-copyfile and --no-xattrs combination, tar will fail on macOS $cmd = sprintf( - 'tar --no-xattrs --disable-copyfile -cf %s -C %s . 2>&1', + 'tar %s -cf %s -C %s . 2>&1', + $additionalFlags, escapeshellarg($tarFilePath), escapeshellarg($sourceDir) );