feat(.github): 感谢 @lxfight,参考 https://github.com/lxfight/astrbot_plugin_mnemosyne 的 actions 实现自动发版和 Issue 模板

This commit is contained in:
SXP-Simon
2025-11-18 22:45:27 +08:00
parent 160fee61c6
commit cba8db126e
5 changed files with 384 additions and 1 deletions
+68
View File
@@ -0,0 +1,68 @@
name: '🐛 报告 Bug'
title: '[Bug]'
description: 提交报告帮助我们改进。
labels: [ 'bug' ]
body:
- type: markdown
attributes:
value: |
感谢您抽出时间报告问题!请准确解释您的问题。如果可能,请提供一个可复现的片段(这有助于更快地解决问题)。
- type: textarea
attributes:
label: 发生了什么
description: 描述你遇到的异常
placeholder: >
一个清晰且具体的描述这个异常
validations:
required: true
- type: textarea
attributes:
label: 如何复现?
description: >
复现该问题的步骤
placeholder: >
如: 1. 打开 '...'
validations:
required: true
- type: textarea
attributes:
label: AstrBot 版本、部署方式(如 Windows Docker Desktop 部署)、使用的消息平台适配器、Milvus部署方式、mnemosyne插件版本
description: >
请提供您的 AstrBot 版本和mnemosyne插件版本。
validations:
required: true
- type: dropdown
attributes:
label: 操作系统
description: |
你在哪个操作系统上遇到了这个问题?
multiple: false
options:
- 'Windows'
- 'macOS'
- 'Linux'
- 'Other'
- 'Not sure'
validations:
required: true
- type: textarea
attributes:
label: 报错日志
description: >
如报错日志、截图等。请提供完整的 Debug 级别的日志!
placeholder: >
请提供完整的报错日志或截图。
validations:
required: true
- type: checkboxes
attributes:
label: 你愿意提交 PR 吗?
description: >
这不是必需的,但我们很乐意在贡献过程中为您提供指导特别是如果你已经很好地理解了如何实现修复。
options:
- label: 是的,我愿意提交 PR!
@@ -0,0 +1,63 @@
name: '✨ 提交新功能建议'
title: '[Feature Request]'
description: 提交您希望看到的新功能,帮助我们优化产品。
labels: [ 'enhancement' ]
body:
- type: markdown
attributes:
value: |
感谢您提出新功能建议!请详细描述您的需求,这将帮助我们更好地理解您的使用场景。
- type: textarea
attributes:
label: 功能描述
description: 简明扼要地描述您希望添加的新功能
placeholder: >
例如:"希望增加一个实时统计用户交互数据的仪表盘"
validations:
required: true
- type: textarea
attributes:
label: 动机与需求背景
description: 说明为什么需要这个功能以及它能解决什么问题
placeholder: >
例如:"当前需要手动导出数据才能分析用户行为,希望自动化生成可视化报告"
validations:
required: true
- type: textarea
attributes:
label: 使用场景或示例
description: 描述该功能可能的使用场景或具体使用案例
validations:
required: true
- type: dropdown
attributes:
label: 优先级建议
description: 您认为这个功能的优先级如何?
multiple: false
options:
- '高优先级(直接影响核心功能)'
- '中优先级(提升使用体验)'
- '低优先级(优化性需求)'
validations:
required: true
- type: checkboxes
attributes:
label: 愿意参与开发吗?
description: |
如果您有技术能力,可以选择参与开发。我们将提供必要的指导和文档支持。
options:
- label: 是的,我愿意协助开发!
- label: 我可以提供详细使用反馈
validations:
required: false
- type: markdown
attributes:
value: |
**注意**:如果您有具体实现方案或技术建议,可以在下方补充说明。
我们会根据需求紧迫性和技术可行性进行评估,感谢您的贡献!
+127
View File
@@ -0,0 +1,127 @@
# GitHub Actions 工作流说明
## 自动发布工作流 (auto-release.yml)
### 功能概述
此工作流会自动检测 `metadata.yaml` 文件中的 `version` 字段变化,当检测到版本号更新时,自动创建一个新的 GitHub Release。
### 触发条件
- 当向 `main` 分支推送提交时
- 且该提交修改了 `metadata.yaml` 文件
### 工作流程
1. **检查版本变化**
- 提取当前 `metadata.yaml` 中的版本号
- 对比上一次提交的版本号
- 判断版本是否发生变化
2. **生成变更日志**
- 如果版本已更新,自动生成变更日志
- 根据提交信息的前缀自动分类:
- `feat:` / `feature:` → ✨ Feature(新功能)
- `fix:` → 🐛 Fix(修复)
- `docs:` → 📚 Docs(文档)
- `refactor:` / `style:` / `perf:` / `test:` / `chore:` → 🔧 其他改进
- 其他 → 📌 普通提交
3. **创建 Release**
- 使用新版本号作为标签名
- 附带自动生成的变更日志
- 提供版本对比链接
### 使用方法
1. **更新版本号**
编辑 `metadata.yaml` 文件,修改 `version` 字段:
```yaml
version: v0.5.3 # 从 v0.5.2 更新到 v0.5.3
```
2. **提交并推送**
```bash
git add metadata.yaml
git commit -m "chore: bump version to v0.5.3"
git push origin main
```
3. **自动发布**
工作流会自动触发并创建 Release,无需手动操作。
### 最佳实践
#### 提交信息格式
为了获得更好的变更日志,建议使用语义化的提交信息格式:
```
<type>: <description>
[optional body]
```
**类型示例:**
- `feat:` 添加新功能
- `fix:` 修复 bug
- `docs:` 文档更新
- `refactor:` 代码重构
- `perf:` 性能优化
- `test:` 测试相关
- `chore:` 构建/工具/依赖更新
**示例:**
```bash
git commit -m "feat: 添加向量搜索功能"
git commit -m "fix: 修复内存泄漏问题"
git commit -m "docs: 更新 API 文档"
```
#### 版本号规范
建议遵循语义化版本控制 (Semantic Versioning)
- `vX.Y.Z` 格式
- `X`:主版本号(重大变更)
- `Y`:次版本号(新功能)
- `Z`:修订号(bug 修复)
**示例:**
- `v0.5.2` → `v0.5.3`bug 修复)
- `v0.5.3` → `v0.6.0`(新功能)
- `v0.6.0` → `v1.0.0`(重大变更)
### 权限要求
工作流需要以下权限:
- `contents: write` - 用于创建 Release 和标签
这些权限已在工作流文件中配置,GitHub Actions 会自动提供。
### 注意事项
1. 确保每次更新版本号时,版本号是递增的
2. 避免在同一次提交中多次修改版本号
3. 如果 Release 创建失败,检查:
- 该版本标签是否已存在
- 仓库是否启用了 GitHub Actions
- 权限设置是否正确
### 查看工作流运行状态
在 GitHub 仓库页面:
1. 点击 "Actions" 标签
2. 查看 "Auto Release on Version Update" 工作流
3. 点击具体的运行记录查看详细日志
### 手动触发(可选)
如需手动创建 Release,可以:
1. 在 GitHub 仓库页面点击 "Releases"
2. 点击 "Draft a new release"
3. 手动填写版本信息和变更日志
但推荐使用自动化工作流以保持一致性。
+122
View File
@@ -0,0 +1,122 @@
name: Auto Release on Version Update
on:
workflow_dispatch:
push:
branches:
- master
paths:
- 'metadata.yaml'
jobs:
check-version:
runs-on: ubuntu-latest
outputs:
version_changed: ${{ steps.check.outputs.changed }}
new_version: ${{ steps.check.outputs.version }}
old_version: ${{ steps.check.outputs.old_version }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Check version change
id: check
run: |
# 获取当前版本
CURRENT_VERSION=$(grep '^version:' metadata.yaml | awk '{print $2}')
echo "Current version: $CURRENT_VERSION"
# 获取上一次提交的版本
git checkout HEAD~1 -- metadata.yaml 2>/dev/null || echo "First commit"
if [ -f metadata.yaml ]; then
PREVIOUS_VERSION=$(grep '^version:' metadata.yaml | awk '{print $2}')
git checkout HEAD -- metadata.yaml
else
PREVIOUS_VERSION="none"
fi
echo "Previous version: $PREVIOUS_VERSION"
# 比较版本
if [ "$CURRENT_VERSION" != "$PREVIOUS_VERSION" ]; then
echo "changed=true" >> $GITHUB_OUTPUT
echo "version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
echo "old_version=$PREVIOUS_VERSION" >> $GITHUB_OUTPUT
echo "Version changed from $PREVIOUS_VERSION to $CURRENT_VERSION"
else
echo "changed=false" >> $GITHUB_OUTPUT
echo "No version change detected"
fi
create-release:
needs: check-version
if: needs.check-version.outputs.version_changed == 'true'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Generate changelog
id: changelog
run: |
NEW_VERSION="${{ needs.check-version.outputs.new_version }}"
OLD_VERSION="${{ needs.check-version.outputs.old_version }}"
echo "## 🎉 Release $NEW_VERSION" > changelog.md
echo "" >> changelog.md
# 如果有上一个版本标签,生成两个版本之间的提交日志
if git rev-parse "$OLD_VERSION" >/dev/null 2>&1; then
echo "### 📝 Changes since $OLD_VERSION" >> changelog.md
echo "" >> changelog.md
# 获取提交信息并分类
git log "$OLD_VERSION..HEAD" --pretty=format:"%s|||%h|||%an" --no-merges | while IFS='|||' read -r subject hash author; do
# 根据提交信息的前缀进行分类
if echo "$subject" | grep -qiE "^(feat|feature):"; then
echo "- ✨ **Feature**: ${subject#*: } (${hash})" >> changelog.md
elif echo "$subject" | grep -qiE "^fix:"; then
echo "- 🐛 **Fix**: ${subject#*: } (${hash})" >> changelog.md
elif echo "$subject" | grep -qiE "^docs:"; then
echo "- 📚 **Docs**: ${subject#*: } (${hash})" >> changelog.md
elif echo "$subject" | grep -qiE "^(refactor|style|perf|test|chore):"; then
prefix=$(echo "$subject" | cut -d: -f1)
echo "- 🔧 **${prefix^}**: ${subject#*: } (${hash})" >> changelog.md
else
echo "- 📌 $subject (${hash})" >> changelog.md
fi
done
else
echo "### 📝 Changes" >> changelog.md
echo "" >> changelog.md
echo "Initial release or no previous version tag found." >> changelog.md
echo "" >> changelog.md
echo "#### Recent commits:" >> changelog.md
git log -10 --pretty=format:"- %s (%h)" --no-merges >> changelog.md
fi
echo "" >> changelog.md
echo "---" >> changelog.md
echo "**Full Changelog**: https://github.com/${{ github.repository }}/compare/$OLD_VERSION...$NEW_VERSION" >> changelog.md
- name: Create Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ needs.check-version.outputs.new_version }}
name: Release ${{ needs.check-version.outputs.new_version }}
body_path: changelog.md
draft: false
prerelease: false
generate_release_notes: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Notify release created
run: |
echo "✅ Release ${{ needs.check-version.outputs.new_version }} has been created successfully!"
echo "🔗 View release at: https://github.com/${{ github.repository }}/releases/tag/${{ needs.check-version.outputs.new_version }}"
+4 -1
View File
@@ -3,7 +3,7 @@
# QQ群日常分析插件
[![Plugin Version](https://img.shields.io/badge/Latest_Version-v3.8.6-blue.svg?style=for-the-badge&color=76bad9)](https://github.com/SXP-Simon/astrbot-qq-group-daily-analysis)
[![Plugin Version](https://img.shields.io/badge/Latest_Version-v3.9.0-blue.svg?style=for-the-badge&color=76bad9)](https://github.com/SXP-Simon/astrbot-qq-group-daily-analysis)
[![AstrBot](https://img.shields.io/badge/AstrBot-Plugin-ff69b4?style=for-the-badge)](https://github.com/AstrBotDevs/AstrBot)
[![License](https://img.shields.io/badge/License-MIT-green.svg?style=for-the-badge)](LICENSE)
@@ -96,6 +96,9 @@ _✨ 一个基于AstrBot的智能群聊分析插件,能够生成精美的群
<details>
<summary>📋 点击展开查看完整更新日志</summary>
### v3.9.0
- 感谢 lxfight,参考 [Mnemosyne-AstrBot长期记忆插件](https://github.com/lxfight/astrbot_plugin_mnemosyne) 实现自动发版和 Issue 模板
### v3.8.0
- feat(multi-qq-platforms): 尝试适配多个适配器实例,支持填入多个QQ账号;
- 可以填写用于自动分析的机器人QQ号、多消息平台QQ号、不希望出现于群分析中的其他人的机器人QQ号等,这种群聊中出现但是不希望分析的QQ号;