-
Notifications
You must be signed in to change notification settings - Fork 87
/
release.php
41 lines (35 loc) · 1.06 KB
/
release.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
/* =======================
打包 zip
======================= */
system('bash produce.sh'); //这里是shell脚本的路径
echo "清理完成,下面执行打包构建...\n";
echo "<br/>";
$zip = new ZipArchive();
$zip->open('WP-Editor.md.zip', ZipArchive::CREATE | ZipArchive::OVERWRITE);
$packageDirs = array('assets', 'languages', 'src', 'vendor');
$packageFiles = array(
'readme.txt',
'LICENSE',
'wp-editormd.php',
'uninstall.php'
);
foreach ($packageDirs as $dir) {
$dirPath = realpath($dir);
$files = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($dirPath),
RecursiveIteratorIterator::LEAVES_ONLY
);
foreach ($files as $name => $file) {
if (!$file->isDir()) {
$relativePath = str_replace($dirPath, "{$dir}/", $file);
$zip->addFile($file, $relativePath);
}
}
}
foreach ($packageFiles as $file) {
$filePath = realpath($file);
$filePath && $zip->addFile($filePath, $file);
}
$zip->close();
echo "<b>WP-Editor.md.zip</b>压缩构建完成\n";