mirror of
https://github.com/linyqh/NarratoAI.git
synced 2025-12-11 10:32:49 +00:00
更新版本号至0.6.2.5,调整发布说明生成逻辑,优化Discord通知格式,并删除不再使用的工作流文件
This commit is contained in:
parent
08abc213fb
commit
6e10adfecb
1
.github/workflows/auto-release-generator.yml
vendored
1
.github/workflows/auto-release-generator.yml
vendored
@ -127,6 +127,7 @@ jobs:
|
|||||||
temperature=0.7,
|
temperature=0.7,
|
||||||
)
|
)
|
||||||
release_notes = response.choices[0].message.content
|
release_notes = response.choices[0].message.content
|
||||||
|
print(f"commits: \n{commits}")
|
||||||
print(f"大模型总结的发布说明: \n{release_notes}")
|
print(f"大模型总结的发布说明: \n{release_notes}")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Error calling OpenAI API: {e}")
|
print(f"Error calling OpenAI API: {e}")
|
||||||
|
|||||||
4
.github/workflows/codeReview.yml
vendored
4
.github/workflows/codeReview.yml
vendored
@ -19,6 +19,6 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GIT_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GIT_TOKEN }}
|
||||||
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
||||||
OPENAI_API_ENDPOINT: https://api.groq.com/openai/v1
|
OPENAI_API_ENDPOINT: https://api.siliconflow.cn/v1
|
||||||
MODEL: llama-3.1-70b-versatile
|
MODEL: deepseek-ai/DeepSeek-V3
|
||||||
LANGUAGE: Chinese
|
LANGUAGE: Chinese
|
||||||
|
|||||||
@ -75,8 +75,8 @@ jobs:
|
|||||||
response = client.chat.completions.create(
|
response = client.chat.completions.create(
|
||||||
model="deepseek-ai/DeepSeek-V3",
|
model="deepseek-ai/DeepSeek-V3",
|
||||||
messages=[
|
messages=[
|
||||||
{"role": "system", "content": "你是一个专业的软件发布公告优化助手。请优化以下发布说明,使其更加生动、专业,并明确区分新功能、优化内容、修复内容和移除内容等类别。保持原有信息的完整性,同时增强可读性和专业性。使用中文回复。"},
|
{"role": "system", "content": "你是一个专业的软件发布公告优化助手。请优化以下发布说明,使其更加生动、专业,并明确区分新功能、优化内容、修复内容和移除内容等类别。保持原有信息的完整性,同时增强可读性和专业性。使用中文回复。\n\n重要:Discord不支持复杂的Markdown格式,因此请使用简单的格式化:\n1. 使用**粗体**和*斜体*而不是Markdown标题\n2. 使用简单的列表符号(•)而不是Markdown列表\n3. 避免使用#、##等标题格式\n4. 不要使用表格、代码块等复杂格式\n5. 确保段落之间有空行\n6. 使用简单的分隔符(如 ------)来分隔不同部分"},
|
||||||
{"role": "user", "content": f"请优化以下版本{version}的发布说明,使其更适合在Discord社区发布:\n\n{release_notes}"}
|
{"role": "user", "content": f"请优化以下版本{version}的发布说明,使其更适合在Discord社区发布。请记住Discord不支持复杂的Markdown格式,所以使用简单的格式化方式:\n\n{release_notes}"}
|
||||||
],
|
],
|
||||||
temperature=0.7,
|
temperature=0.7,
|
||||||
)
|
)
|
||||||
@ -101,26 +101,85 @@ jobs:
|
|||||||
color="5865F2" # Discord蓝色
|
color="5865F2" # Discord蓝色
|
||||||
)
|
)
|
||||||
|
|
||||||
# 添加润色后的发布说明
|
# 处理发布说明,确保不超过Discord的字段限制
|
||||||
if enhanced_notes:
|
# Discord字段值限制为1024个字符
|
||||||
embed.add_embed_field(name="更新内容", value=enhanced_notes[:1024] if len(enhanced_notes) > 1024 else enhanced_notes)
|
MAX_FIELD_LENGTH = 1024
|
||||||
|
|
||||||
# 如果内容太长,分段添加
|
# 如果内容很短,直接添加
|
||||||
if len(enhanced_notes) > 1024:
|
if enhanced_notes and len(enhanced_notes) <= MAX_FIELD_LENGTH:
|
||||||
remaining = enhanced_notes[1024:]
|
embed.add_embed_field(name="📋 更新内容", value=enhanced_notes)
|
||||||
chunks = [remaining[i:i+1024] for i in range(0, len(remaining), 1024)]
|
elif enhanced_notes:
|
||||||
for i, chunk in enumerate(chunks):
|
# 尝试按段落或明显的分隔符分割内容
|
||||||
embed.add_embed_field(name=f"更新内容(续{i+1})", value=chunk)
|
sections = []
|
||||||
|
|
||||||
|
# 检查是否有明显的新功能、优化、修复等部分
|
||||||
|
if "**新增功能**" in enhanced_notes or "**新功能**" in enhanced_notes:
|
||||||
|
parts = enhanced_notes.split("**新增功能**", 1)
|
||||||
|
if len(parts) > 1:
|
||||||
|
intro = parts[0].strip()
|
||||||
|
if intro:
|
||||||
|
sections.append(("📋 更新概述", intro))
|
||||||
|
|
||||||
|
rest = "**新增功能**" + parts[1]
|
||||||
|
|
||||||
|
# 进一步分割剩余部分
|
||||||
|
feature_end = -1
|
||||||
|
for marker in ["**优化内容**", "**性能优化**", "**修复内容**", "**bug修复**", "**问题修复**"]:
|
||||||
|
pos = rest.lower().find(marker.lower())
|
||||||
|
if pos != -1 and (feature_end == -1 or pos < feature_end):
|
||||||
|
feature_end = pos
|
||||||
|
|
||||||
|
if feature_end != -1:
|
||||||
|
sections.append(("✨ 新增功能", rest[:feature_end].strip()))
|
||||||
|
rest = rest[feature_end:]
|
||||||
else:
|
else:
|
||||||
embed.add_embed_field(name="更新内容", value="无详细更新内容")
|
sections.append(("✨ 新增功能", rest.strip()))
|
||||||
|
rest = ""
|
||||||
|
|
||||||
|
# 继续分割剩余部分
|
||||||
|
if rest:
|
||||||
|
optimize_end = -1
|
||||||
|
for marker in ["**修复内容**", "**bug修复**", "**问题修复**"]:
|
||||||
|
pos = rest.lower().find(marker.lower())
|
||||||
|
if pos != -1 and (optimize_end == -1 or pos < optimize_end):
|
||||||
|
optimize_end = pos
|
||||||
|
|
||||||
|
if optimize_end != -1:
|
||||||
|
sections.append(("⚡ 优化内容", rest[:optimize_end].strip()))
|
||||||
|
sections.append(("🔧 修复内容", rest[optimize_end:].strip()))
|
||||||
|
else:
|
||||||
|
sections.append(("⚡ 优化内容", rest.strip()))
|
||||||
|
else:
|
||||||
|
# 如果没有明显的结构,按长度分割
|
||||||
|
chunks = [enhanced_notes[i:i+MAX_FIELD_LENGTH] for i in range(0, len(enhanced_notes), MAX_FIELD_LENGTH)]
|
||||||
|
for i, chunk in enumerate(chunks):
|
||||||
|
if i == 0:
|
||||||
|
sections.append(("📋 更新内容", chunk))
|
||||||
|
else:
|
||||||
|
sections.append((f"📋 更新内容(续{i})", chunk))
|
||||||
|
|
||||||
|
# 添加所有部分到embed
|
||||||
|
for name, content in sections:
|
||||||
|
if len(content) > MAX_FIELD_LENGTH:
|
||||||
|
# 如果单个部分仍然过长,进一步分割
|
||||||
|
sub_chunks = [content[i:i+MAX_FIELD_LENGTH] for i in range(0, len(content), MAX_FIELD_LENGTH)]
|
||||||
|
for i, chunk in enumerate(sub_chunks):
|
||||||
|
if i == 0:
|
||||||
|
embed.add_embed_field(name=name, value=chunk)
|
||||||
|
else:
|
||||||
|
embed.add_embed_field(name=f"{name}(续{i})", value=chunk)
|
||||||
|
else:
|
||||||
|
embed.add_embed_field(name=name, value=content)
|
||||||
|
else:
|
||||||
|
embed.add_embed_field(name="📋 更新内容", value="无详细更新内容")
|
||||||
|
|
||||||
# 添加下载链接
|
# 添加下载链接
|
||||||
html_url = release_info.get("html_url", "")
|
html_url = release_info.get("html_url", "")
|
||||||
if html_url:
|
if html_url:
|
||||||
embed.add_embed_field(name="下载链接", value=html_url)
|
embed.add_embed_field(name="📥 下载链接", value=html_url, inline=False)
|
||||||
|
|
||||||
# 设置页脚
|
# 设置页脚
|
||||||
embed.set_footer(text="NarratoAI 团队")
|
embed.set_footer(text=f"NarratoAI 团队 • {release_date}")
|
||||||
embed.set_timestamp()
|
embed.set_timestamp()
|
||||||
|
|
||||||
# 添加嵌入式消息到webhook
|
# 添加嵌入式消息到webhook
|
||||||
|
|||||||
48
.github/workflows/dockerImageBuild.yml
vendored
48
.github/workflows/dockerImageBuild.yml
vendored
@ -1,48 +0,0 @@
|
|||||||
name: build_docker
|
|
||||||
|
|
||||||
on:
|
|
||||||
release:
|
|
||||||
types: [created] # 表示在创建新的 Release 时触发
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build_docker:
|
|
||||||
name: Build docker
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Remove unnecessary files
|
|
||||||
run: |
|
|
||||||
sudo rm -rf /usr/share/dotnet
|
|
||||||
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: Set up QEMU
|
|
||||||
uses: docker/setup-qemu-action@v3
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
|
|
||||||
- name: Login to DockerHub
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Extract project version
|
|
||||||
id: extract_version
|
|
||||||
run: |
|
|
||||||
project_version=$(grep 'project_version' config.example.toml | cut -d '"' -f 2)
|
|
||||||
echo "PROJECT_VERSION=$project_version" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Build and push
|
|
||||||
id: docker_build
|
|
||||||
uses: docker/build-push-action@v6
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
file: ./Dockerfile
|
|
||||||
push: true
|
|
||||||
platforms: linux/amd64,linux/arm64
|
|
||||||
tags: |
|
|
||||||
${{ secrets.DOCKERHUB_USERNAME }}/narratoai:${{ env.PROJECT_VERSION }}
|
|
||||||
${{ secrets.DOCKERHUB_USERNAME }}/narratoai:latest
|
|
||||||
40
.github/workflows/latest-changes.yml
vendored
40
.github/workflows/latest-changes.yml
vendored
@ -1,40 +0,0 @@
|
|||||||
name: Latest Changes
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request_target:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
types:
|
|
||||||
- closed
|
|
||||||
workflow_dispatch:
|
|
||||||
inputs:
|
|
||||||
number:
|
|
||||||
description: PR number
|
|
||||||
required: true
|
|
||||||
debug_enabled:
|
|
||||||
description: "在启用 tmate 调试的情况下运行构建 (https://github.com/marketplace/actions/debugging-with-tmate)"
|
|
||||||
required: false
|
|
||||||
default: "false"
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
latest-changes:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
permissions:
|
|
||||||
pull-requests: read
|
|
||||||
steps:
|
|
||||||
- name: Dump GitHub context
|
|
||||||
env:
|
|
||||||
GITHUB_CONTEXT: ${{ toJson(github) }}
|
|
||||||
run: echo "$GITHUB_CONTEXT"
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
# 允许将最新更改提交到主分支
|
|
||||||
token: ${{ secrets.GIT_TOKEN }}
|
|
||||||
- uses: tiangolo/latest-changes@0.3.2
|
|
||||||
with:
|
|
||||||
token: ${{ secrets.GIT_TOKEN }}
|
|
||||||
latest_changes_file: ./release-notes.md
|
|
||||||
latest_changes_header: "## Latest Changes"
|
|
||||||
end_regex: "^## "
|
|
||||||
debug_logs: true
|
|
||||||
label_header_prefix: "### "
|
|
||||||
22
.github/workflows/release-drafter.yml
vendored
22
.github/workflows/release-drafter.yml
vendored
@ -1,22 +0,0 @@
|
|||||||
name: Release Drafter
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
pull_request:
|
|
||||||
types: [opened, reopened, synchronize]
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
update_release_draft:
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
pull-requests: write
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: release-drafter/release-drafter@v5
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GIT_TOKEN }}
|
|
||||||
@ -1 +1 @@
|
|||||||
0.6.2.4
|
0.6.2.5
|
||||||
Loading…
x
Reference in New Issue
Block a user