给版本命令增加自动推送功能

This commit is contained in:
2022-07-18 09:53:11 +08:00
parent c249027be2
commit f1580eb417

View File

@@ -1,5 +1,6 @@
<?php
declare (strict_types = 1);
declare(strict_types=1);
namespace app\common\command\admin;
@@ -8,31 +9,34 @@ use think\console\Input;
use think\console\input\Argument;
use think\console\input\Option;
use think\console\Output;
use think\facade\App;
class Version extends Command
{
const VERSION = 'v2.0.6';
const VERSION = 'v2.0.7';
const COMMENT = [
'完善特效皮肤的细节问题',
'给版本命令增加自动推送功能',
];
protected function configure()
{
// 指令配置
$this->setName('admin:version')
->addOption('push-tag', null, Option::VALUE_NONE, '使用git命令生成tag并推送')
->setDescription('查看当前ulthon_admin的版本号');
}
protected function execute(Input $input, Output $output)
{
// 指令输出
$output->info('当前版本号为:'.$this::VERSION);
$output->info('当前版本号为:' . $this::VERSION);
$output->writeln('当前的修改说明:');
$output->writeln('>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>');
foreach ($this::COMMENT as $comment) {
$output->info($comment);
}
@@ -40,9 +44,17 @@ class Version extends Command
$output->highlight('代码托管地址https://gitee.com/ulthon/ulthon_admin');
$output->highlight('开发文档地址http://doc.ulthon.com/home/read/ulthon_admin/home.html');
$is_push_tag = $input->hasOption('push-tag');
if ($is_push_tag) {
$root_path = App::getRootPath();
$version = $this::VERSION;
$comment = implode(';', $this::COMMENT);
exec("git tag -a $version -m \"$comment\"");
exec("git push --tags");
}
}
}