mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2026-02-06 13:05:09 +00:00
feat: 自动化version打包
This commit is contained in:
61
.github/prompt/release_note_prompt.txt
vendored
Normal file
61
.github/prompt/release_note_prompt.txt
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
注意:输出必须严格使用 NapCat 的发布说明格式,并用简体中文。
|
||||
|
||||
格式规则:
|
||||
1. 第一行:# V{TAG}
|
||||
2. 第二行:[使用文档](https://napneko.github.io/)
|
||||
3. 空行后,按下面的节顺序输出(存在则输出,不存在则省略该节):
|
||||
|
||||
## Windows 一键包
|
||||
- 简短一句话介绍一键包用途
|
||||
- 列出可下载的文件名(只列文件名,不写下载链接)
|
||||
|
||||
## 警告
|
||||
- 如果有需要特别提醒的兼容/运行库/版本要求,写成加粗警告句
|
||||
|
||||
## 如果WinX64缺少运行库或者xxx.dll?
|
||||
- 常见运行库建议
|
||||
|
||||
## 更新
|
||||
按数字序列列出主要变更项,每条尽量一句话
|
||||
- 前缀短 commit id,例如:1. a1b2c3d 修复 get_essence_msg_list 崩溃
|
||||
- 保持 4-18 条要点
|
||||
|
||||
## 开发者注意
|
||||
- 列出迁移/接口断裂/配置变更;若无则省略
|
||||
|
||||
额外约束:
|
||||
- 语言简体中文,面向最终用户
|
||||
- 不输出 stack trace、密钥、敏感信息
|
||||
- 只列文件名作为 assets,不写链接
|
||||
- 若提交为空,输出简短默认说明
|
||||
|
||||
下面为示例
|
||||
|
||||
# V?.?.?
|
||||
[使用文档](https://napneko.github.io/)
|
||||
|
||||
## Windows 一键包
|
||||
我们为提供了的轻量化一键部署方案
|
||||
相对于普通需要安装QQ的方案,下面已内置QQ和Napcat 阅读使用文档参考
|
||||
|
||||
你可以下载
|
||||
|
||||
NapCat.Shell.Windows.OneKey.zip (无头)
|
||||
|
||||
启动后可自动化部署一键包,教程参考使用文档安装部分
|
||||
|
||||
## 警告
|
||||
**注意QQ版本推荐使用 40768+ 版本 最低可以使用40768版本**
|
||||
**默认WebUi密钥为随机密码 控制台查看**
|
||||
|
||||
**[9.9.22-40990 X64 Win](https://dldir1v6.qq.com/qqfile/qq/QQNT/2c9d3f6c/QQ9.9.22.40990_x64.exe)**
|
||||
[LinuxX64 DEB 40990 ](https://dldir1.qq.com/qqfile/qq/QQNT/ec800879/linuxqq_3.2.20-40990_amd64.deb)
|
||||
[LinuxX64 RPM 40990 ](https://dldir1.qq.com/qqfile/qq/QQNT/ec800879/linuxqq_3.2.20-40990_x86_64.rpm)
|
||||
[LinuxArm64 DEB 40990 ](https://dldir1.qq.com/qqfile/qq/QQNT/ec800879/linuxqq_3.2.20-40990_arm64.deb)
|
||||
[LinuxArm64 RPM 40990 ](https://dldir1.qq.com/qqfile/qq/QQNT/ec800879/linuxqq_3.2.20-40990_aarch64.rpm)
|
||||
[MAC DMG 40990 ](https://dldir1v6.qq.com/qqfile/qq/QQNT/c6cb0f5d/QQ_v6.9.82.40990.dmg)
|
||||
## 如果WinX64缺少运行库或者xxx.dll?
|
||||
[安装运行库](https://aka.ms/vs/17/release/vc_redist.x64.exe)
|
||||
|
||||
## 更新
|
||||
1. xxxx
|
||||
166
.github/workflows/auto-release.yml
vendored
Normal file
166
.github/workflows/auto-release.yml
vendored
Normal file
@@ -0,0 +1,166 @@
|
||||
name: Build Release (OpenRouter AI notes on tag)
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '*' # 任意 tag push 时触发,可改为 'v*.*.*'
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
env:
|
||||
OPENROUTER_API_URL: https://openrouter.ai/api/v1/chat/completions
|
||||
OPENROUTER_MODEL: "deepseek/deepseek-chat-v3-0324:free"
|
||||
RELEASE_NAME: "NapCat"
|
||||
|
||||
jobs:
|
||||
Build-LiteLoader:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20.x
|
||||
- name: Build NapCat.Framework
|
||||
run: |
|
||||
npm i -g pnpm
|
||||
pnpm i
|
||||
pnpm --filter napcat-webui-frontend run build || exit 1
|
||||
pnpm run build:framework
|
||||
mv packages/napcat-framework/dist framework-dist
|
||||
cd framework-dist
|
||||
npm install --omit=dev
|
||||
rm -f package-lock.json
|
||||
- name: Upload Artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: NapCat.Framework
|
||||
path: framework-dist
|
||||
|
||||
Build-Shell:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20.x
|
||||
- name: Build NapCat.Shell
|
||||
run: |
|
||||
npm i -g pnpm
|
||||
pnpm i
|
||||
pnpm --filter napcat-webui-frontend run build || exit 1
|
||||
pnpm run build:shell
|
||||
mv packages/napcat-shell/dist shell-dist
|
||||
cd shell-dist
|
||||
npm install --omit=dev
|
||||
rm -f package-lock.json
|
||||
- name: Upload Artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: NapCat.Shell
|
||||
path: shell-dist
|
||||
|
||||
release-napcat:
|
||||
needs: [Build-LiteLoader, Build-Shell]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Download artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: ./artifacts
|
||||
|
||||
- name: Make zips
|
||||
run: |
|
||||
cd artifacts || exit 0
|
||||
[ -d NapCat.Shell ] && (cd NapCat.Shell && zip -qr ../NapCat.Shell.zip .)
|
||||
[ -d NapCat.Framework ] && (cd NapCat.Framework && zip -qr ../NapCat.Framework.zip .)
|
||||
cd ..
|
||||
ls -la
|
||||
|
||||
- name: Prepare commits list
|
||||
run: |
|
||||
TAG="${GITHUB_REF#refs/tags/}"
|
||||
git fetch --all --tags || true
|
||||
PREV_TAG=$(git tag --sort=-creatordate | grep -v "^$" | awk -v t="$TAG" '$0!=t{print; exit}')
|
||||
if [ -n "$PREV_TAG" ]; then
|
||||
git log --pretty=format:'%h %s (%an)' "$PREV_TAG..$TAG" > /tmp/commits.txt || git log --pretty=format:'%h %s (%an)' -n 30 > /tmp/commits.txt
|
||||
else
|
||||
git log --pretty=format:'%h %s (%an)' -n 30 > /tmp/commits.txt
|
||||
fi
|
||||
echo "=== commits ==="
|
||||
sed -n '1,200p' /tmp/commits.txt || true
|
||||
|
||||
- name: Generate release note via OpenRouter
|
||||
env:
|
||||
OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
|
||||
OPENROUTER_API_URL: ${{ env.OPENROUTER_API_URL }}
|
||||
OPENROUTER_MODEL: ${{ env.OPENROUTER_MODEL }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
PROMPT_FILE=".github/prompt/release_note_prompt.txt"
|
||||
TAG="${GITHUB_REF#refs/tags/}"
|
||||
ARTIFACTS_LIST=$(ls ./artifacts 2>/dev/null | tr '\n' ',' | sed 's/,$//')
|
||||
COMMITS=$(sed 's/"/\\"/g' /tmp/commits.txt || echo "无提交信息")
|
||||
USER_CONTENT="$(printf "TAG: %s\nARTIFACTS: %s\n\n提交列表:\n%s" "$TAG" "$ARTIFACTS_LIST" "$COMMITS")"
|
||||
SYSTEM_PROMPT="$(jq -Rs . < "$PROMPT_FILE")"
|
||||
|
||||
BODY=$(jq -n \
|
||||
--arg system "$SYSTEM_PROMPT" \
|
||||
--arg user "$USER_CONTENT" \
|
||||
'{model: env.OPENROUTER_MODEL, messages: [{role:"system", content:$system},{role:"user", content:$user}], temperature:0.2, max_tokens:800}')
|
||||
|
||||
RESPONSE=$(curl -s -X POST "$OPENROUTER_API_URL" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: Bearer $OPENROUTER_API_KEY" \
|
||||
-d "$BODY")
|
||||
|
||||
echo "$RESPONSE" | jq -r '.choices[0].message.content // .choices[0].text // ""' > /tmp/release_body.txt || true
|
||||
echo "=== generated release note ==="
|
||||
sed -n '1,200p' /tmp/release_body.txt || true
|
||||
|
||||
- name: Create or update release & upload assets
|
||||
env:
|
||||
GHTOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
REPO: ${{ github.repository }}
|
||||
TAG: "${{ github.ref_name }}"
|
||||
run: |
|
||||
set -euo pipefail
|
||||
BODY=$(sed 's/"/\\"/g' /tmp/release_body.txt || echo "Automated release")
|
||||
# check existing release for this tag
|
||||
EXIST=$(curl -s -H "Authorization: token $GHTOKEN" "https://api.github.com/repos/$REPO/releases/tags/$TAG" || true)
|
||||
RID=$(echo "$EXIST" | jq -r '.id // empty')
|
||||
if [ -n "$RID" ]; then
|
||||
echo "Update existing release id $RID"
|
||||
jq -n --arg body "$BODY" '{body:$body}' > /tmp/update.json
|
||||
curl -s -X PATCH -H "Authorization: token $GHTOKEN" -H "Content-Type: application/json" \
|
||||
"https://api.github.com/repos/$REPO/releases/$RID" -d @/tmp/update.json | jq -r '.id'
|
||||
else
|
||||
echo "Create release for tag $TAG"
|
||||
jq -n --arg tag "$TAG" --arg name "${RELEASE_NAME} $TAG" --arg body "$BODY" \
|
||||
'{tag_name:$tag, name:$name, body:$body, draft:true, prerelease:false}' > /tmp/create.json
|
||||
CREATE_RESP=$(curl -s -X POST -H "Authorization: token $GHTOKEN" -H "Content-Type: application/json" \
|
||||
"https://api.github.com/repos/$REPO/releases" -d @/tmp/create.json)
|
||||
RID=$(echo "$CREATE_RESP" | jq -r '.id')
|
||||
fi
|
||||
|
||||
upload() {
|
||||
f="$1"
|
||||
[ -f "$f" ] || { echo "skip $f"; return; }
|
||||
NAME=$(basename "$f")
|
||||
UPLOAD_URL=$(curl -s -H "Authorization: token $GHTOKEN" "https://api.github.com/repos/$REPO/releases/$RID" | jq -r '.upload_url')
|
||||
UPLOAD_URL="${UPLOAD_URL%\{*}?name=${NAME}"
|
||||
echo "Uploading $NAME..."
|
||||
curl -s -X POST -H "Authorization: token $GHTOKEN" -H "Content-Type: application/zip" --data-binary @"$f" "$UPLOAD_URL" | jq -r '.id'
|
||||
}
|
||||
|
||||
upload "./artifacts/NapCat.Framework.zip"
|
||||
upload "./artifacts/NapCat.Shell.zip"
|
||||
echo "done"
|
||||
Reference in New Issue
Block a user