Merge branch 'main' into next

This commit is contained in:
nocobase[bot]
2026-04-09 10:16:47 +00:00
3 changed files with 151 additions and 0 deletions
+28
View File
@@ -342,3 +342,31 @@ jobs:
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ env.ALL_FULL_TAGS }}
feishu-notify:
runs-on: ubuntu-latest
if: always()
needs:
- publish-npm
- push-docker
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.ref_name }}
- name: Determine overall result
id: result
shell: bash
run: |
if [[ "${{ needs.publish-npm.result }}" == "success" && "${{ needs.push-docker.result }}" == "success" ]]; then
echo "status=success" >> $GITHUB_OUTPUT
else
echo "status=failure" >> $GITHUB_OUTPUT
fi
- name: Send Feishu notification
shell: bash
env:
WEBHOOK_URL: ${{ secrets.RELEASE_RESULT_FEISHU_WEBHOOK_URL }}
VERSION: ${{ github.ref_name }}
STATUS: ${{ steps.result.outputs.status }}
WORKFLOW_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
run: bash scripts/feishu-release-notify.sh
+41
View File
@@ -0,0 +1,41 @@
name: Test Feishu Release Notification
on:
workflow_dispatch:
inputs:
version:
description: 'Version tag (e.g. v2.0.34)'
required: true
default: 'v0.0.0-test'
status:
description: 'Build status'
required: true
type: choice
options:
- success
- failure
default: 'success'
build_time:
description: 'Build time (leave empty for current time)'
required: false
default: ''
workflow_url:
description: 'Workflow URL (leave empty for current run URL)'
required: false
default: ''
jobs:
test-notify:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Send Feishu notification
shell: bash
env:
WEBHOOK_URL: ${{ secrets.RELEASE_RESULT_FEISHU_WEBHOOK_URL }}
VERSION: ${{ inputs.version }}
STATUS: ${{ inputs.status }}
BUILD_TIME: ${{ inputs.build_time }}
WORKFLOW_URL: ${{ inputs.workflow_url || format('{0}/{1}/actions/runs/{2}', github.server_url, github.repository, github.run_id) }}
run: bash scripts/feishu-release-notify.sh
+82
View File
@@ -0,0 +1,82 @@
#!/usr/bin/env bash
# Send a Feishu interactive card notification for release results.
#
# Required environment variables:
# WEBHOOK_URL - Feishu bot webhook URL
# VERSION - Release version (e.g. v2.0.34)
# STATUS - "success" or "failure"
# WORKFLOW_URL - Link to the GitHub Actions run
#
# Optional environment variables:
# BUILD_TIME - Build timestamp (defaults to current time in Asia/Shanghai)
set -euo pipefail
: "${WEBHOOK_URL:?WEBHOOK_URL is required}"
: "${VERSION:?VERSION is required}"
: "${STATUS:?STATUS must be 'success' or 'failure'}"
: "${WORKFLOW_URL:?WORKFLOW_URL is required}"
BUILD_TIME="${BUILD_TIME:-$(TZ="Asia/Shanghai" date +"%Y-%m-%d %H:%M:%S")}"
if [[ "$STATUS" == "success" ]]; then
HEADER_TEMPLATE="green"
STATUS_TEXT="构建成功"
STATUS_EMOJI="✅"
else
HEADER_TEMPLATE="red"
STATUS_TEXT="构建失败"
STATUS_EMOJI="❌"
fi
TITLE="NocoBase 版本 ${VERSION} Release 结果通知"
PAYLOAD=$(cat <<EOF
{
"msg_type": "interactive",
"card": {
"header": {
"title": {
"tag": "plain_text",
"content": "${TITLE}"
},
"template": "${HEADER_TEMPLATE}"
},
"elements": [
{
"tag": "div",
"text": {
"tag": "lark_md",
"content": "**版本:**${VERSION}\n**时间:**${BUILD_TIME}\n**状态:**${STATUS_EMOJI} ${STATUS_TEXT}"
}
},
{
"tag": "action",
"actions": [
{
"tag": "button",
"text": {
"tag": "plain_text",
"content": "查看构建详情"
},
"url": "${WORKFLOW_URL}",
"type": "primary"
}
]
}
]
}
}
EOF
)
RESPONSE=$(curl -s -o /dev/null -w "%{http_code}" -X POST "$WEBHOOK_URL" \
-H 'Content-Type: application/json' \
-d "$PAYLOAD")
if [[ "$RESPONSE" -ge 200 && "$RESPONSE" -lt 300 ]]; then
echo "Feishu notification sent successfully (HTTP ${RESPONSE})"
else
echo "Failed to send Feishu notification (HTTP ${RESPONSE})" >&2
exit 1
fi