Skip to content

armgit / dbx

Public Imported from GitHub
0

25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。

feat(ci): add release notification and improve message formatting

t8y2519f18bfd9bf
diff --git a/.github/workflows/qq-notify.yml b/.github/workflows/qq-notify.yml
index ea298672b1..2765849301 100644
--- a/.github/workflows/qq-notify.yml
+++ b/.github/workflows/qq-notify.yml
@@ -5,38 +5,104 @@ on:
types: [opened]
pull_request_target:
types: [opened, closed]
+ release:
+ types: [published]
jobs:
notify:
runs-on: ubuntu-latest
+ if: ${{ github.event_name != 'release' || (!github.event.release.draft && !github.event.release.prerelease) }}
steps:
- name: Build message
id: msg
+ env:
+ EVENT_NAME: ${{ github.event_name }}
+ EVENT_ACTION: ${{ github.event.action }}
+ ISSUE_TITLE: ${{ github.event.issue.title }}
+ ISSUE_URL: ${{ github.event.issue.html_url }}
+ ISSUE_USER: ${{ github.event.issue.user.login }}
+ PR_TITLE: ${{ github.event.pull_request.title }}
+ PR_URL: ${{ github.event.pull_request.html_url }}
+ PR_USER: ${{ github.event.pull_request.user.login }}
+ PR_MERGED: ${{ github.event.pull_request.merged }}
+ PR_MERGED_BY: ${{ github.event.pull_request.merged_by.login }}
+ RELEASE_TAG: ${{ github.event.release.tag_name }}
+ RELEASE_NAME: ${{ github.event.release.name }}
+ RELEASE_URL: ${{ github.event.release.html_url }}
+ RELEASE_BODY: ${{ github.event.release.body }}
run: |
- if [ "${{ github.event_name }}" = "issues" ]; then
- TITLE="${{ github.event.issue.title }}"
- URL="${{ github.event.issue.html_url }}"
- USER="${{ github.event.issue.user.login }}"
- MSG="📋 新 Issue: ${TITLE}\n提交者: ${USER}\n${URL}"
- elif [ "${{ github.event.action }}" = "opened" ]; then
- TITLE="${{ github.event.pull_request.title }}"
- URL="${{ github.event.pull_request.html_url }}"
- USER="${{ github.event.pull_request.user.login }}"
- MSG="🔀 新 PR: ${TITLE}\n提交者: ${USER}\n${URL}"
- elif [ "${{ github.event.action }}" = "closed" ] && [ "${{ github.event.pull_request.merged }}" = "true" ]; then
- TITLE="${{ github.event.pull_request.title }}"
- URL="${{ github.event.pull_request.html_url }}"
- USER="${{ github.event.pull_request.merged_by.login }}"
- MSG="✅ PR 已合并: ${TITLE}\n合并者: ${USER}\n${URL}"
- else
- echo "skip=true" >> "$GITHUB_OUTPUT"
- exit 0
- fi
- echo "skip=false" >> "$GITHUB_OUTPUT"
- EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
- echo "msg<<$EOF" >> "$GITHUB_OUTPUT"
- echo -e "$MSG" >> "$GITHUB_OUTPUT"
- echo "$EOF" >> "$GITHUB_OUTPUT"
+ python3 - <<'PYEOF'
+ import os
+
+ event = os.environ["EVENT_NAME"]
+ action = os.environ.get("EVENT_ACTION", "")
+ msg = None
+
+ if event == "issues":
+ title = os.environ["ISSUE_TITLE"]
+ url = os.environ["ISSUE_URL"]
+ user = os.environ["ISSUE_USER"]
+ msg = "\n".join([
+ "━━━━━━━━━━━━━━━",
+ "📋 新 Issue",
+ "━━━━━━━━━━━━━━━",
+ f"标题: {title}",
+ f"提交者: {user}",
+ f"链接: {url}",
+ "━━━━━━━━━━━━━━━",
+ ])
+
+ elif event == "release":
+ tag = os.environ["RELEASE_TAG"]
+ name = os.environ["RELEASE_NAME"]
+ url = os.environ["RELEASE_URL"]
+ body = os.environ.get("RELEASE_BODY", "")[:500]
+ msg = "\n".join([
+ "━━━━━━━━━━━━━━━",
+ f"🚀 新版本发布 {tag}",
+ "━━━━━━━━━━━━━━━",
+ f"{name}",
+ "",
+ body,
+ "",
+ f"下载: {url}",
+ "━━━━━━━━━━━━━━━",
+ ])
+
+ elif event in ("pull_request", "pull_request_target"):
+ title = os.environ["PR_TITLE"]
+ url = os.environ["PR_URL"]
+ if action == "opened":
+ user = os.environ["PR_USER"]
+ msg = "\n".join([
+ "━━━━━━━━━━━━━━━",
+ "🔀 新 Pull Request",
+ "━━━━━━━━━━━━━━━",
+ f"标题: {title}",
+ f"提交者: {user}",
+ f"链接: {url}",
+ "━━━━━━━━━━━━━━━",
+ ])
+ elif action == "closed" and os.environ.get("PR_MERGED") == "true":
+ user = os.environ.get("PR_MERGED_BY", "unknown")
+ msg = "\n".join([
+ "━━━━━━━━━━━━━━━",
+ "✅ PR 已合并",
+ "━━━━━━━━━━━━━━━",
+ f"标题: {title}",
+ f"合并者: {user}",
+ f"链接: {url}",
+ "━━━━━━━━━━━━━━━",
+ ])
+
+ with open(os.environ["GITHUB_OUTPUT"], "a") as f:
+ if msg:
+ f.write(f"skip=false\n")
+ delim = "EOF_MSG"
+ f.write(f"msg<<{delim}\n{msg}\n{delim}\n")
+ else:
+ f.write(f"skip=true\n")
+ PYEOF
- name: Send to QQ group
if: steps.msg.outputs.skip != 'true'
@@ -44,13 +110,14 @@ jobs:
SSH_KEY: ${{ secrets.DEPLOY_SSH_KEY }}
HOST: ${{ secrets.DEPLOY_HOST }}
ASTRBOT_API_KEY: ${{ secrets.ASTRBOT_API_KEY }}
+ MSG_CONTENT: ${{ steps.msg.outputs.msg }}
run: |
mkdir -p ~/.ssh
echo "$SSH_KEY" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
ssh-keyscan -H "$HOST" >> ~/.ssh/known_hosts 2>/dev/null
- MSG=$(echo '${{ steps.msg.outputs.msg }}' | jq -Rs .)
+ MSG=$(echo "$MSG_CONTENT" | jq -Rs .)
ssh "root@${HOST}" "curl -s -X POST http://localhost:6185/api/v1/im/message \
-H 'Authorization: Bearer ${ASTRBOT_API_KEY}' \
-H 'Content-Type: application/json' \