mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-07-08 19:12:48 +08:00
给版本命令增加自动推送功能
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace app\common\command\admin;
|
namespace app\common\command\admin;
|
||||||
@@ -8,25 +9,28 @@ use think\console\Input;
|
|||||||
use think\console\input\Argument;
|
use think\console\input\Argument;
|
||||||
use think\console\input\Option;
|
use think\console\input\Option;
|
||||||
use think\console\Output;
|
use think\console\Output;
|
||||||
|
use think\facade\App;
|
||||||
|
|
||||||
class Version extends Command
|
class Version extends Command
|
||||||
{
|
{
|
||||||
|
|
||||||
const VERSION = 'v2.0.6';
|
const VERSION = 'v2.0.7';
|
||||||
|
|
||||||
const COMMENT = [
|
const COMMENT = [
|
||||||
'完善特效皮肤的细节问题',
|
'给版本命令增加自动推送功能',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected function configure()
|
protected function configure()
|
||||||
{
|
{
|
||||||
// 指令配置
|
// 指令配置
|
||||||
$this->setName('admin:version')
|
$this->setName('admin:version')
|
||||||
|
->addOption('push-tag', null, Option::VALUE_NONE, '使用git命令生成tag并推送')
|
||||||
->setDescription('查看当前ulthon_admin的版本号');
|
->setDescription('查看当前ulthon_admin的版本号');
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function execute(Input $input, Output $output)
|
protected function execute(Input $input, Output $output)
|
||||||
{
|
{
|
||||||
|
|
||||||
// 指令输出
|
// 指令输出
|
||||||
$output->info('当前版本号为:' . $this::VERSION);
|
$output->info('当前版本号为:' . $this::VERSION);
|
||||||
|
|
||||||
@@ -41,8 +45,16 @@ class Version extends Command
|
|||||||
$output->highlight('代码托管地址:https://gitee.com/ulthon/ulthon_admin');
|
$output->highlight('代码托管地址:https://gitee.com/ulthon/ulthon_admin');
|
||||||
$output->highlight('开发文档地址:http://doc.ulthon.com/home/read/ulthon_admin/home.html');
|
$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");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user