feat: 提交tag时支持markdown格式

This commit is contained in:
augushong
2025-03-11 11:07:03 +08:00
parent 304669dcc2
commit f96fbd745a

View File

@@ -98,10 +98,23 @@ class VersionBase extends Command
if (!empty(static::PRODUCT_VERSION)) {
$version = static::PRODUCT_VERSION;
}
$comment = implode(';', static::COMMENT);
// 将提交信息写入临时文件
$comment = implode("\n", static::COMMENT);
$output->info('生成标签:' . $version);
$output->info('标签描述:' . $comment);
exec("git tag -a $version -m \"$comment\"");
// 使用项目的临时文件路径生成方法
$tempFile = PathTools::tempBuildPath('git_tag_message_' . uniqid() . '.txt');
file_put_contents($tempFile, $comment);
// 使用 -F 参数从文件读取提交信息
exec("git tag -a $version -F \"$tempFile\"");
// 删除临时文件
if (file_exists($tempFile)) {
unlink($tempFile);
}
$output->info('推送到远程仓库');
exec('git push --tags');
}
@@ -187,6 +200,6 @@ class VersionBase extends Command
$tmp_comment_markdown_file = PathTools::tempBuildPath('commit_comment.md');
file_put_contents($tmp_comment_markdown_file, $comment);
$this->output->info('已生成版本更新Markdown'. $tmp_comment_markdown_file);
$this->output->info('已生成版本更新Markdown' . $tmp_comment_markdown_file);
}
}