9 Star 99 Fork 24

贵州猿创科技有限责任公司 / xhadmin

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
deployment.php 1.09 KB
一键复制 编辑 原始数据 按行查看 历史
Unknown 提交于 2024-02-21 17:45 . q
<?php
namespace think;
use Exception;
use YcOpen\CloudService\Cloud;
use YcOpen\CloudService\Request\SystemUpdateRequest;
define('ROOT_PATH', __DIR__);
require ROOT_PATH . '/vendor/autoload.php';
// 执行HTTP应用并响应
$http = (new App())->http;
$response = $http->run();
$http->end($response);
header('Content-Type:application/json; charset=utf-8');
try {
# 写入版本信息
$req = new SystemUpdateRequest;
$req->newVersion();
$cloud = new Cloud($req);
$data = $cloud->send();
if (!isset($data->version)) {
throw new Exception('获取最新版本失败');
}
$version = (int)$data->version;
$versionData = [
'version' => $version+1,
'version_name' => $data->version_name
];
$versionJson = json_encode($versionData, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
file_put_contents(ROOT_PATH . '/config/version.json', $versionJson);
exec("git add config/version.json");
echo '最新版本自动部署成功!';
echo PHP_EOL;
} catch (\Throwable $e) {
exit($e->getMessage());
}
PHP
1
https://gitee.com/yc_open/xhadmin.git
git@gitee.com:yc_open/xhadmin.git
yc_open
xhadmin
xhadmin
master

搜索帮助

53164aa7 5694891 3bd8fe86 5694891