diff --git a/resources/build/build.php b/resources/build/build.php index 8421557..528ac4c 100644 --- a/resources/build/build.php +++ b/resources/build/build.php @@ -79,10 +79,33 @@ $sgCommand = sprintf( system($sgCommand); echo 'Creating the release archive...' . PHP_EOL . PHP_EOL; -system('git add --force vendor/'); -system('git stash'); -system(sprintf('git archive --format zip --output %1$s/blue-twilight_%2$s.zip --prefix=blue-twilight_%2$s/ "stash@{0}"', $argv[2], $argv[1])); -system('git stash pop'); +$rootPath = dirname(dirname(__DIR__)); + +// Initialize archive object +$zip = new ZipArchive(); +$zip->open(sprintf('%s/blue-twilight_%s.zip', $argv[1], $argv[0]), ZipArchive::CREATE | ZipArchive::OVERWRITE); + +/** @var SplFileInfo[] $files */ +$files = new RecursiveIteratorIterator( + new RecursiveDirectoryIterator($rootPath), + RecursiveIteratorIterator::LEAVES_ONLY +); + +foreach ($files as $name => $file) +{ + // Skip directories (they will be added automatically) + if (!$file->isDir()) + { + // Get real and relative path for current file + $filePath = $file->getRealPath(); + $relativePath = substr($filePath, strlen($rootPath) + 1); + + // Add current file to archive + $zip->addFile($filePath, $relativePath); + } +} + +$zip->close(); echo PHP_EOL . PHP_EOL; echo 'All done!';