Compare commits

...
5 Commits
Author SHA1 Message Date
手瓜一十雪 2ad2af4d7c Trigger release workflow on tag push
AI RELEASE NapCat / Build-LiteLoader (push) Canceled after 0s
AI RELEASE NapCat / Build-Shell (push) Canceled after 0s
AI RELEASE NapCat / release-napcat (push) Canceled after 0s
Changed the workflow trigger from pushes to the main branch to pushes of any tag. This enables releases to be automatically created when a new tag is pushed.
2025-11-13 18:57:37 +08:00
手瓜一十雪 2a160d296f Remove tag trigger from auto-release workflow
The workflow will no longer be triggered by tag pushes, only by pushes to the main branch.
2025-11-13 18:57:20 +08:00
手瓜一十雪 e43f229e04 Update import paths to use direct module references
Changed import statements from alias-based paths (e.g., '@/napcat-common/store') to direct module references (e.g., 'napcat-common/src/store') in Proxy.ts, Status.ts, Data.ts, and SignToken.ts for improved compatibility and clarity.
2025-11-13 18:56:51 +08:00
手瓜一十雪 9158ebc136 Update workflow name to AI RELEASE NapCat
Renamed the GitHub Actions workflow from 'Build Action' to 'AI RELEASE NapCat' for improved clarity and identification.
2025-11-13 18:55:01 +08:00
手瓜一十雪 d758fe3a2b Improve release note generation in workflow
Build Action / Build-LiteLoader (push) Canceled after 0s
Build Action / Build-Shell (push) Canceled after 0s
Build Action / release-napcat (push) Canceled after 0s
Enhances the release note generation step to compare commits between the previous and current tags, includes commit bodies and authors, and formats output for better readability. Also adds more robust extraction and output handling for the generated release notes.
2025-11-13 18:53:19 +08:00
5 changed files with 28 additions and 13 deletions

No files matched your search

+24 -9
View File
@@ -1,12 +1,10 @@
name: "Build Action"
name: AI RELEASE NapCat
on:
workflow_dispatch:
push:
branches:
- main
tags:
- '*' # 任意 tag push 时触发
- '*'
permissions: write-all
@@ -84,7 +82,7 @@ jobs:
[ -d NapCat.Framework ] && zip -qr ../NapCat.Framework.zip -r NapCat.Framework
[ -d NapCat.Shell ] && zip -qr ../NapCat.Shell.zip -r NapCat.Shell
cd ..
- name: Generate release note via OpenRouter
env:
OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
@@ -92,17 +90,32 @@ jobs:
OPENROUTER_MODEL: ${{ env.OPENROUTER_MODEL }}
run: |
set -euo pipefail
TAG="${GITHUB_REF#refs/tags/}"
COMMITS=$(git log --pretty=format:'%h %s (%an)' -n 30)
# 当前 tag
CURRENT_TAG="${GITHUB_REF#refs/tags/}"
# 上一个 tag
PREV_TAG=$(git describe --tags --abbrev=0 "$CURRENT_TAG^")
echo "Generating release note from $PREV_TAG to $CURRENT_TAG"
# 获取 commit title + body + 作者,保留换行
COMMITS=$(git log --pretty=format:'%h %B (%an)' "$PREV_TAG".."$CURRENT_TAG" | sed 's/$/\\n/')
# 读取 prompt
PROMPT_FILE=".github/prompt/release_note_prompt.txt"
SYSTEM_PROMPT=$(<"$PROMPT_FILE")
USER_CONTENT="TAG: $TAG\n提交列表:\n$COMMITS"
# 构建用户内容
USER_CONTENT="TAG: $CURRENT_TAG\n提交列表:\n$COMMITS"
# 构建请求 JSON
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}')
# 调用 OpenRouter
RESPONSE=$(curl -s -X POST "$OPENROUTER_API_URL" \
-H "Authorization: Bearer $OPENROUTER_API_KEY" \
-H "Content-Type: application/json" \
@@ -111,6 +124,7 @@ jobs:
echo "=== OpenRouter raw response ==="
echo "$RESPONSE" | jq .
# 提取生成内容
RELEASE_BODY=$(echo "$RESPONSE" | jq -r '.choices[0].message.content // .choices[0].text // ""')
if [ -z "$RELEASE_BODY" ]; then
@@ -118,7 +132,8 @@ jobs:
exit 1
fi
echo "$RELEASE_BODY" > CHANGELOG.md
# 输出到 CHANGELOG.md
echo -e "$RELEASE_BODY" > CHANGELOG.md
echo "=== generated release note ==="
cat CHANGELOG.md
@@ -1,5 +1,5 @@
import { RequestHandler } from 'express';
import { RequestUtil } from '@/napcat-common/request';
import { RequestUtil } from 'napcat-common/src/request';
import { sendError, sendSuccess } from '../utils/response';
export const GetProxyHandler: RequestHandler = async (req, res) => {
@@ -1,5 +1,5 @@
import { RequestHandler } from 'express';
import { SystemStatus, statusHelperSubscription } from '@/napcat-core/helper/status';
import { SystemStatus, statusHelperSubscription } from 'napcat-core/helper/status';
export const StatusRealTimeHandler: RequestHandler = async (req, res) => {
res.setHeader('Content-Type', 'text/event-stream');
@@ -1,6 +1,6 @@
import type { LoginRuntimeType } from '../types/data';
import packageJson from '../../../../package.json';
import store from '@/napcat-common/store';
import store from 'napcat-common/src/store';
const LoginRuntime: LoginRuntimeType = {
LoginCurrentTime: Date.now(),
@@ -1,5 +1,5 @@
import crypto from 'crypto';
import store from '@/napcat-common/store';
import store from 'napcat-common/src/store';
export class AuthHelper {
private static readonly secretKey = Math.random().toString(36).slice(2);