Removed the dependency on git for creating the zip archive
This commit is contained in:
parent
8eff022fc7
commit
24d9c318cb
@ -79,10 +79,33 @@ $sgCommand = sprintf(
|
|||||||
system($sgCommand);
|
system($sgCommand);
|
||||||
|
|
||||||
echo 'Creating the release archive...' . PHP_EOL . PHP_EOL;
|
echo 'Creating the release archive...' . PHP_EOL . PHP_EOL;
|
||||||
system('git add --force vendor/');
|
$rootPath = dirname(dirname(__DIR__));
|
||||||
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]));
|
// Initialize archive object
|
||||||
system('git stash pop');
|
$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 PHP_EOL . PHP_EOL;
|
||||||
echo 'All done!';
|
echo 'All done!';
|
||||||
|
Loading…
Reference in New Issue
Block a user