lichi / deploy_daemon_bot
Deploy daemon bot
dev-main
2020-12-13 12:11 UTC
Requires
- php: >=7.4
- ext-curl: *
- ext-json: *
Requires (Dev)
- phpunit/phpunit: ^9.3
- squizlabs/php_codesniffer: ^3.5
- vimeo/psalm: ^4.0
This package is auto-updated.
Last update: 2025-03-13 21:28:24 UTC
README
Install with composer
composer require lichi/deploy_daemon_bot
require class
require "vendor/autoload.php";
use Daemon\Sdk\Init;
make anon-s functions before and after pull data
$afterHandler = $beforeHandler = function (array $filesMap, string $type_pull, array $config) {
$dirs = $config['dirs'];
foreach ($filesMap as $path=>$file) {
if (isset($dirs[$path])) {
$dirInfo = $dirs[$path];
if (isset($dirInfo[$type_pull])) {
$beforePullExecution = $dirInfo[$type_pull];
if (count($beforePullExecution) > 0) {
$resultExecution = [];
exec($beforePullExecution, $resultExecution);
$this->logger($resultExecution);
}
}
}
}
return true;
};
Run Init
$deploy = new Init($argv, $beforeHandler, $afterHandler, false);
CLI-Commands:
php script init # make config file
php script start # start handle pull-requests
Config-file: deploy-config.json
{
"branch": "main",
"dirs":{
"./":{
"before_pull":[
'pm2 stop 0'
],
"after_pull":[
'pm2 start 0'
]
}
}
}