diff --git a/app/common/command/admin/Version.php b/app/common/command/admin/Version.php index 5b5dd66..661a376 100644 --- a/app/common/command/admin/Version.php +++ b/app/common/command/admin/Version.php @@ -1,5 +1,6 @@ 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"); + } } }