Create release package cleanly from a temporary folder (#279)

This commit is contained in:
Pierre Rudloff 2020-06-22 23:15:31 +02:00
parent 251fbe48ca
commit a518e3b7b3
2 changed files with 22 additions and 41 deletions

View file

@ -1,7 +1,6 @@
<?php <?php
use Robo\Tasks; use Robo\Tasks;
use Symfony\Component\Finder\Finder;
/** /**
* Manage robo tasks. * Manage robo tasks.
@ -15,51 +14,33 @@ class RoboFile extends Tasks
*/ */
public function release() public function release()
{ {
$this->stopOnFail();
$result = $this->taskExec('git') $result = $this->taskExec('git')
->args('describe') ->arg('describe')
->run(); ->run();
$result->provideOutputdata(); $result->provideOutputdata();
$tag = trim($result->getOutputData());
// We don't want the whole vendor directory. $tmpDir = $this->_tmpDir();
$finder = new Finder();
$finder->files()
->in(__DIR__ . '/vendor/')
->exclude(
[
'ffmpeg/',
'phpstan/',
'bin/',
'anam/phantomjs-linux-x86-binary/',
'phpunit/',
'squizlabs/',
'rinvex/countries/resources/geodata/',
'rinvex/countries/resources/flags/'
]
);
$zipTask = $this->taskPack('alltube-' . $tag . '.zip') $filename = 'alltube-' . trim($result->getOutputData()) . '.zip';
->add('index.php')
->add('config/config.example.yml')
->add('.htaccess')
->add('img')
->add('LICENSE')
->add('README.md')
->add('robots.txt')
->add('resources')
->add('templates')
->add('templates_c/')
->add('classes')
->add('controllers')
->add('css')
->add('i18n');
foreach ($finder as $file) { $this->taskFilesystemStack()
if ($path = $file->getRelativePathname()) { ->remove($filename)
$zipTask->add('vendor/' . $path); ->run();
}
}
$zipTask->run(); $this->taskGitStack()
->cloneRepo(__DIR__, $tmpDir)
->run();
$this->taskComposerInstall()
->dir($tmpDir)
->optimizeAutoloader()
->noDev()
->run();
$this->taskPack($filename)
->addDir('alltube', $tmpDir)
->run();
} }
} }

View file

@ -92,7 +92,7 @@
"scripts": { "scripts": {
"lint": "grumphp run --ansi", "lint": "grumphp run --ansi",
"test": "phpunit", "test": "phpunit",
"release": "robo release", "release": "robo release --ansi",
"update-locales": [ "update-locales": [
"tsmarty2c.php templates > i18n/template.pot", "tsmarty2c.php templates > i18n/template.pot",
"xgettext --omit-header -kt -j -o i18n/template.pot classes/*.php classes/*/*.php controllers/*" "xgettext --omit-header -kt -j -o i18n/template.pot classes/*.php classes/*/*.php controllers/*"