Skip to content

Commit 869baa7

Browse files
committed
feat: add ding notify
1 parent 3f5cec6 commit 869baa7

1 file changed

Lines changed: 59 additions & 14 deletions

File tree

.github/workflows/publish-maven.yml

Lines changed: 59 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -72,23 +72,68 @@ jobs:
7272
7373
echo "✅ Publishing completed"
7474
75-
- name: Notify on success
76-
if: success()
75+
notify-success:
76+
needs: publish
77+
runs-on: ubuntu-latest
78+
if: success()
79+
steps:
80+
- name: Checkout code
81+
uses: actions/checkout@v4
82+
83+
- name: Determine version type
84+
id: version
7785
run: |
7886
if [[ "${{ github.ref }}" == refs/tags/* ]]; then
79-
echo "✅ Released ${{ github.ref_name }} to Maven Central"
80-
echo "⚠️ Next step: Manually publish in Central Portal:"
81-
echo " https://central.sonatype.com/publishing/deployments"
87+
echo "type=正式版" >> $GITHUB_OUTPUT
88+
echo "version=${{ github.ref_name }}" >> $GITHUB_OUTPUT
8289
else
83-
echo "✅ Published snapshot from ${{ github.ref_name }} branch"
84-
echo "📍 Snapshot repository: https://central.sonatype.com/repository/maven-snapshots/"
90+
echo "type=快照版" >> $GITHUB_OUTPUT
91+
echo "version=${{ github.ref_name }}-SNAPSHOT" >> $GITHUB_OUTPUT
8592
fi
8693
87-
- name: Notify on failure
88-
if: failure()
94+
- name: Notify deployment success
95+
uses: zcong1993/actions-ding@master
96+
with:
97+
dingToken: ${{ secrets.DING_TALK_TOKEN }}
98+
secret: ${{ secrets.DING_TALK_SECRET }}
99+
body: |
100+
{
101+
"msgtype": "markdown",
102+
"markdown": {
103+
"title": "fc-sdk-android 发布通知",
104+
"text": "### ✅ fc-sdk-android 发布成功\n\n---\n\n 🔖 版本: ${{ steps.version.outputs.version }}\n\n 📦 类型: ${{ steps.version.outputs.type }}\n\n 👨‍💻 发布者: ${{ github.actor }}\n\n 🚀 [查看详情](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})"
105+
}
106+
}
107+
108+
notify-failure:
109+
needs: publish
110+
runs-on: ubuntu-latest
111+
if: failure()
112+
steps:
113+
- name: Checkout code
114+
uses: actions/checkout@v4
115+
116+
- name: Determine version type
117+
id: version
89118
run: |
90-
echo "❌ Publishing failed. Check logs for details."
91-
echo "Common issues:"
92-
echo " - GPG key not properly configured"
93-
echo " - Maven Central credentials incorrect"
94-
echo " - Build or test failures"
119+
if [[ "${{ github.ref }}" == refs/tags/* ]]; then
120+
echo "type=正式版" >> $GITHUB_OUTPUT
121+
echo "version=${{ github.ref_name }}" >> $GITHUB_OUTPUT
122+
else
123+
echo "type=快照版" >> $GITHUB_OUTPUT
124+
echo "version=${{ github.ref_name }}-SNAPSHOT" >> $GITHUB_OUTPUT
125+
fi
126+
127+
- name: Notify deployment failure
128+
uses: zcong1993/actions-ding@master
129+
with:
130+
dingToken: ${{ secrets.DING_TALK_TOKEN }}
131+
secret: ${{ secrets.DING_TALK_SECRET }}
132+
body: |
133+
{
134+
"msgtype": "markdown",
135+
"markdown": {
136+
"title": "fc-sdk-android 发布通知",
137+
"text": "### ❌ fc-sdk-android 发布失败\n\n---\n\n 🔖 版本: ${{ steps.version.outputs.version }}\n\n 📦 类型: ${{ steps.version.outputs.type }}\n\n 👨‍💻 发布者: ${{ github.actor }}\n\n 🚀 [查看详情](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})"
138+
}
139+
}

0 commit comments

Comments
 (0)